[Tkinter-discuss] How to make all the buttons the same size?
globalrev
skanemupp at yahoo.se
Sat Apr 5 02:28:43 CEST 2008
Buttons shrink to fit the symbol/text u put on it. well i dont want that it
looks ugly. how do i set the same size for all the buttons?
i thought it was row/columnspan at first but it doesnt seem to work.
[code]
#! /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", state=DISABLED)
self.btnDisplay.grid(row=0, column=0, padx=5, pady=5)
self.btnDisplay = Button(self, text="2", state=DISABLED)
self.btnDisplay.grid(row=0, column=1, padx=5, pady=5)
self.btnDisplay = Button(self, text="3", state=DISABLED)
self.btnDisplay.grid(row=0, column=2, padx=5, pady=5)
self.btnDisplay = Button(self, text="+", state=DISABLED)
self.btnDisplay.grid(row=0, column=3, padx=5, pady=5)
self.btnDisplay = Button(self, text="4", state=DISABLED)
self.btnDisplay.grid(row=1, column=0, padx=5, pady=5)
self.btnDisplay = Button(self, text="5", state=DISABLED)
self.btnDisplay.grid(row=1, column=1, padx=5, pady=5)
self.btnDisplay = Button(self, text="6", state=DISABLED)
self.btnDisplay.grid(row=1, column=2, padx=5, pady=5)
self.btnDisplay = Button(self, text="-", state=DISABLED)
self.btnDisplay.grid(row=1, column=3, padx=5, pady=5)
self.btnDisplay = Button(self, text="7", state=DISABLED)
self.btnDisplay.grid(row=2, column=0, padx=5, pady=5)
self.btnDisplay = Button(self, text="8", state=DISABLED)
self.btnDisplay.grid(row=2, column=1, padx=5, pady=5)
self.btnDisplay = Button(self, text="9", state=DISABLED)
self.btnDisplay.grid(row=2, column=2, padx=5, pady=5)
self.btnDisplay = Button(self, text="*", state=DISABLED)
self.btnDisplay.grid(row=2, column=3, padx=5, pady=5)
self.btnDisplay = Button(self, text="0", state=DISABLED)
self.btnDisplay.grid(row=3, column=0, padx=5, pady=5)
self.btnDisplay = Button(self, text="C", state=DISABLED)
self.btnDisplay.grid(row=3, column=1, padx=5, pady=5)
self.btnDisplay = Button(self, text="r", state=DISABLED)
self.btnDisplay.grid(row=3, column=2, padx=5, pady=5)
self.btnDisplay = Button(self, text="/", state=DISABLED)
self.btnDisplay.grid(row=3, column=3, padx=5, pady=5)
#def Display(self):
if __name__ == "__main__":
guiFrame = GUIFramework()
guiFrame.mainloop()
[/code]
--
View this message in context: http://www.nabble.com/How-to-make-all-the-buttons-the-same-size--tp16507347p16507347.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
More information about the Tkinter-discuss
mailing list