Tkinter: making buttons the same size?

skanemupp at yahoo.se skanemupp at yahoo.se
Sat Apr 5 11:29:43 EDT 2008


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)

    def Display(self, number):
        print number

if __name__ == "__main__":
    guiFrame = GUIFramework()
    guiFrame.mainloop()



More information about the Python-list mailing list