[Tkinter-discuss] How do you get your application to open up with a
specific, static siz e?
clnethery at juno.com
clnethery at juno.com
Thu Mar 25 16:51:24 EST 2004
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 following code illustrates what I am referring to:
import sys
import Tkinter
import Pmw
root = Tkinter.Tk()
root.title('Tool')
Pmw.initialise(root)
Mainframe = Tkinter.Frame(root, width=1015, height=705)
### menubar ###
class AtsMenuBar:
menuDict = {
}
def __init__(self):
menuBar=Pmw.MenuBar(Mainframe, hull_relief='raised', hull_borderwidth=1)
menuBar.pack(fill='x')
menuBar.addmenu('File', 'Close this window or exit')
menuBar.addcascademenu('File', 'New', 'Set some other preferences', traverseSpec = 'z', tearoff = 1)
menuBar.addmenuitem('File', 'command', 'Save this application', command='save', label='Save')
menuBar.addmenuitem('File', 'command', 'Open up SaveAs dialog', command='saveas', label='Save As')
menuBar.addmenuitem('File', 'separator')
menuBar.addmenuitem('File', 'command', 'Exit the application', command='exit', label='Exit')
menuBar.addmenu('Edit', 'Undo, Cut, Copy, Paste, Select All or Delete')
menuBar.addmenuitem('Edit', 'command', 'Undo last action', command='undo', label='Undo')
menuBar.addmenuitem('Edit', 'command', 'Cut the current selection', command='cut', label='Cut')
menuBar.addmenuitem('Edit', 'command', 'Copy the current selection', command='copy', label='Copy')
menuBar.addmenuitem('Edit', 'command', 'Paste the current selection', command='paste', label='Paste')
menuBar.addmenuitem('Edit', 'command', 'Select All', command='selectAll', label='Select All')
menuBar.addmenuitem('Edit', 'command', 'Delete', command='delete', label='Delete')
menuBar.addmenu('Help', 'Help Topics', 'About')
menuBar.addmenuitem('Help', 'command', 'Show help topics', command='helptopics', label='Help topics')
menuBar.addmenuitem('Help', 'command', 'Show About window', command='AboutUs', label='About Us')
menuBar.addcascademenu('New', 'Thing', 'Set some other preferences', traverseSpec = 'z', tearoff = 1)
menuBar.addmenuitem('New', 'command', 'Thing2', command = 'Thing2', label = 'Thing2')
menuBar.addmenuitem('New', 'command', 'Thing3', command = 'Thing3', label = 'Thing3')
menuBar.addmenuitem('Thing', 'command', 'Stuff1', command = 'Stuff1', label = 'Stuff1')
menuBar.addmenuitem('Thing', 'command', 'Stuff2', command = 'Stuff2', label = 'Stuff2')
menuBar.addmenuitem('Thing', 'command', 'Stuff3', command = 'Stuff3', label = 'Stuff3')
menuBar.addmenuitem('Thing', 'command', 'Stuff4', command = 'Stuff4', label = 'Stuff4')
menuBar.addmenuitem('Thing', 'command', 'Stuff5', command = 'Stuff5', label = 'Stuff5')
menu = AtsMenuBar()
Mainframe.pack(fill = 'both', expand = 1, padx = 5, pady = 5)
if __name__ == '__main__':
try:
root.mainloop()
except:
sys.exit('\nUnexpected exception. Terminating application.')
More information about the Tkinter-discuss
mailing list