471,122 Members | 1,128 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

Bizarre sizing problem in Tkinter- Need Help

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
1 1073
jlm699
314 100+
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.

Similar topics

2 posts views Thread by Rick Olson | last post: by
2 posts views Thread by Paul A. Wilson | last post: by
7 posts views Thread by Justin Ezequiel | last post: by
25 posts views Thread by BJörn Lindqvist | last post: by
1 post views Thread by syed_saqib_ali | last post: by
reply views Thread by syed_saqib_ali | last post: by
1 post views Thread by noman | last post: by
1 post views Thread by Michael Yanowitz | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.