Reputation: 5712
I've done plenty of Tkinter Python apps before, but I've never come across this problem:
How do you set the dimensions of the initial (root) window in Tkinter with Python 3?
I've come across this question which details the answer for Python 2.7, but Tkinter has been updated for Python 3 so the solution doesn't work.
Here's the obnoxious bit of code:
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self,master)
self.grid()
self.createWidgets()
master.minsize(width=500,height=500)
app = Application()
app.master.title("MFPA")
app.mainloop()
The master.minsize()
line comes from the referenced question, but since my master
object is None
, the method doesn't exist.
The second solution there also doesn't work, as it relies on having called the tk.Tk()
method to start with, whereas I am using the updated Tkinter and this new method of creating windows.
Upvotes: 3
Views: 5082
Reputation: 76184
The tk.Frame.__init__
call should automatically find the master for you and assign it to an attribute of the object. Try:
self.master.minsize(width=500,height=500)
Upvotes: 5