[Tkinter-discuss] How do you get your application to open up
with a specific, static siz e?
klappnase at web.de
Thu Mar 25 17:42:49 EST 2004
On Thu, 25 Mar 2004 21:51:24 GMT
clnethery at juno.com wrote:
> I am developing an application that I want to open up at a specific size. For some reason, I cannot get the application to open up full-size. When I run it, it is minimized and all scrunched up. Specifically, I am wondering why the following line, "Mainframe = Tkinter.Frame(root, width=1015, height=705)" doesn't automatically open the application fullsize.
The reason is that your Mainframe widget doesn't contain anything except the MenuBar and the default behavior of
a Frame is to only take the size on the screen that is actually required by the widgets it contains.
If you want to take your Frame the size you defined anyway, you will have to use:
Mainframe.pack(fill = 'both', expand = 1, padx = 5, pady = 5)
to override this default behavior.
However, if you want to open your app in full-size I would prefer the Tk.geometry() method:
You can even check out the screenwidth and -height to make this independent from the actual screen resolution settings:
>>> w, h = r.maxsize()
>>> print w
>>> print h
I hope this helps
More information about the Tkinter-discuss