By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,096 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,096 IT Pros & Developers. It's quick & easy.

Bizarre sizing problem in Tkinter- Need Help

P: 1
I need help with this problem I'm facing when I use Tkinter to make a GUI.

The app window is the correct sige h = 200, w = 400 if I don't add a button to the script. The weird thing is, the minute I add a button widget the main app window completely ignores the size configuration and becomes very small.

I've been trying to crack this problem for ages but nothing seem to work. Could someone please tell me how I keep my main app window the given size even with a button widget.

Comment out the button widget and you'll be able to see what I mean.

Regards


Chew


Expand|Select|Wrap|Line Numbers
  1. from Tkinter import *
  2.  
  3. def theCall():
  4.     app.quit()
  5.  
  6.  
  7. app = Tk()
  8.  
  9. testb = Button(app, text = "test", command = theCall)
  10. testb.pack()
  11.  
  12. app.config(height = 200, width = 400)
  13.  
  14.  
  15. app.mainloop()
  16.  
  17.  
  18.  
  19.  
Apr 1 '08 #1
Share this Question
Share on Google+
1 Reply


jlm699
100+
P: 314
Expand|Select|Wrap|Line Numbers
  1. app.pack_propagate(0)
If you add this line before you pack the button your application's frame will not condense to the size of the widget.
Apr 1 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.