Issue
From a more complex example, i distilled this minimal example:
from tkinter import Frame, Tk
class Example(Frame):
def __init__(self, master):
super().__init__(master)
plt.figure() # this makes the window smaller
def main():
root = Tk()
root.geometry("500x500")
app = Example(root)
root.mainloop()
if __name__ == '__main__':
main()
The plt.figure()
makes the window smaller and the process not end when I click the X on the top right. I really don't understand how a matplotlib command could cause this behaviour. A plt.close()
allows me to kill the process by closing the window, but doesn't solve the size problem, and starts up the window behind other open windows.
Solution
Solved it by using plt.Figure()
instead. Also plt.savefig()
poses this problem, so if anyone reading this has this same issue, you can try:
fig = plt.Figure()
# work on figure...
fig.savefig("file.png")
Answered By - rikyeah
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.