TKinter, buttonwidget response problem(1) and all btns the same size(2)!

7stud bbxx789_05ss at yahoo.com
Sat Apr 5 05:16:07 EDT 2008


skanem... at yahoo.se wrote:
>
> one thing i dont rally get, i ahve to add my_button.bind() somewhere?
> i changed the stuff u said though and i get this error(the program
> executes though and i can press the buttons):
>
> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
>     return self.func(*args)
> TypeError: Display() takes exactly 2 arguments (1 given)
>
>
> current version:
> #! /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):
>
>         enText = Entry(self)
>         enText.grid(row=0, column=0, columnspan=8, padx=5, pady=5)
>
>         enText = Entry(self)
>         enText.grid(row=1, column=0, columnspan=8, padx=5, pady=5)
>
>         btnDisplay = Button(self, text="1", command=self.Display)
>         btnDisplay.grid(row=3, column=0, padx=5, pady=5)


You still have this in your code:

btnDisplay = Button(self, text="1", command=self.Display)

I suggest you reread my earlier post again.   Or, follow the advice
given by Marc 'BlackJack' Rintsch (preferable).  But whatever you do,
don't use both command and bind().



More information about the Python-list mailing list