Tkinter: making buttons the same size?

Guilherme Polo ggpolo at gmail.com
Sat Apr 5 12:14:37 EDT 2008


2008/4/5, skanemupp at yahoo.se <skanemupp at yahoo.se>:
> on windows vista these buttons dont have the same size, the "/"
>  shrinks a little. how do i make them the same size or prevent
>  shrinking?
>  a mac-user told me they look the same to him so maybe it doesnt shrink
>  on macs but it does when using VISTA.
>
>  i tried some .propagate and extend-stuff but didnt work.
>
>  #! /usr/bin/env python
>  from Tkinter import *
>  import tkMessageBox
>
>  class GUIFramework(Frame):
>     """This is the GUI"""
>
>     def __init__(self, master=None):
>         """Initialize yourself"""
>
>         """Initialise the base class"""
>         Frame.__init__(self,master)
>
>         """Set the Window Title"""
>         self.master.title("Calculator")
>
>         """Display the main window"
>         with a little bit of padding"""
>         self.grid(padx=10,pady=10)
>         self.CreateWidgets()
>
>
>
>     def CreateWidgets(self):
>
>
>         self.btnDisplay = Button(self,text='1',command=lambda
>  n=1:self.Display(n))
>         self.btnDisplay.grid(row=3, column=0, padx=5, pady=5)
>
>         self.btnDisplay = Button(self,text='/',command=lambda
>  n="/":self.Display(n))
>         self.btnDisplay.grid(row=6, column=3, padx=5, pady=5)
>

Specify width=1 for both buttons.

>     def Display(self, number):
>         print number
>
>  if __name__ == "__main__":
>     guiFrame = GUIFramework()
>     guiFrame.mainloop()
>
> --
>  http://mail.python.org/mailman/listinfo/python-list
>


-- 
-- Guilherme H. Polo Goncalves



More information about the Python-list mailing list