Maximize main window with code

J

JohnJohnUSA

I am new to Python. How do I get the following program to appea
initially with the window maximized? Thanks for your help

from Tkinter import
# set up the window itsel
top = Tk(
F = Frame(top
F.pack(
# add the widget
lHello = Label(F, text="Hello"
lHello.pack(
bQuit = Button(F, text="Quit", command=F.quit
bQuit.pack(
# set the loop runnin
top.mainloop(
 
J

James Stroud

JohnJohnUSA said:
I am new to Python. How do I get the following program to appear
initially with the window maximized? Thanks for your help!

from Tkinter import *
# set up the window itself
top = Tk()
F = Frame(top)
F.pack()
# add the widgets
lHello = Label(F, text="Hello")
lHello.pack()
bQuit = Button(F, text="Quit", command=F.quit)
bQuit.pack()
# set the loop running
top.mainloop()

This gets pretty close:

top.geometry('%sx%s+0+0' % top.maxsize())

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
 
F

Fredrik Lundh

JohnJohnUSA said:
I am new to Python. How do I get the following program to appear
initially with the window maximized? Thanks for your help!

from Tkinter import *
# set up the window itself
top = Tk()
top.state("zoomed")

F = Frame(top)
F.pack()
# add the widgets
lHello = Label(F, text="Hello")
lHello.pack()
bQuit = Button(F, text="Quit", command=F.quit)
bQuit.pack()
# set the loop running
top.mainloop()

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top