Set initial size in TKinter

Gabor Urban urbangabo at gmail.com
Tue Dec 20 06:09:41 EST 2011


Hi,

I am quite newbie with Tkinter and I could not find the way to set the
size of the application. (I could find the method to make it
resizeable, though :-)) ) Any ideas, suggestions or links to
references are wellcome.

Here is my code:

from Tkinter import *

class Application(Frame):
    def say_hi(self):
	self.db += 1
        print 'hi there, -->> UG everyone! db = %d'%self.db

## TODO: meretezhetoseg
    def createWidgets(self):
      top = self.winfo_toplevel()
      top.rowconfigure(0,weight = 1)
      top.columnconfigure(0,weight = 1)
      self.rowconfigure(0,weight = 1)
      self.columnconfigure(0,weight = 1)
      self.QUIT = Button(self)
      self.QUIT["text"] = "QUIT"
      self.QUIT["fg"]   = "red"
      self.QUIT["command"] =  self.quit

      self.QUIT.pack({"side": "left"})

      self.hi_there = Button(self)
      self.hi_there["text"] = "Hello",
      self.hi_there["command"] = self.say_hi

      self.hi_there.pack({"side": "left"})

    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        self.createWidgets()
	self.db = 0

app = Application()
app.master.title('UG test')
app.mainloop()



Thx in advance...

Gabor

-- 
Linux is like a wigwam: no Gates, no Windows and an Apache inside.



More information about the Python-list mailing list