#๐ How can I fix this?
39 messages ยท Page 1 of 1 (latest)
@unkempt steppe
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
!code ๐
self.plot_canvas.get_tk_widget().destroy()
if self.toolbar:
self.toolbar.destroy()
self.plot_canvas = FigureCanvasTkAgg(fig, master=self.plot_frame)
self.plot_canvas.draw()
self.plot_canvas.get_tk_widget().pack(fill=tk.BOTH, expand=True)
# Add toolbar for zoom, pan, and save
self.toolbar = NavigationToolbar2Tk(self.plot_canvas, self.plot_frame)
self.toolbar.update()
except Exception as e:(
messagebox.showerror("Error", f"Failed to plot equation: {e}"))
Can you show the whole code?
sure
The indentation of your except block does not look right
Would also be useful to know exactly what the problem is
The line before an except should be at a different indentation level
Yup, that's the problem
Your indentation is messed up
oh
and whenever i update my code on Pycharm, it wont update when i run it... why is this so?
is this how it should look like?
No, they were just uploading it as a paste for better readability.
ohh
Your problem is as Meltz stated, your except needs to be on the same indentation level as your try
Line 379 and 380 need to be indented once
ahh gotcha
and this?
no i pasted it there for highlighting
You need to save it first
i am but its not working still
The issue here is the thing i've already said 3 times
indent?
yes
The line after the except needs to be indented as well
Now read this
#1338984317979725906 message
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.