Python Forum
[Tkinter] Arguments in function for button command
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Arguments in function for button command
#1
New to Python. No matter what I enter, it doesn't like the arguments in the function. Appreciate any help.
Error:
Exception in Tkinter callback Traceback (most recent call last):   File "C:\Python27\lib\lib-tk\Tkinter.py", line 1536, in __call__     return self.func(*args) TypeError: go() takes exactly 1 argument (0 given)
The function is inside a class and the command for a button. It takes entries from two entry boxes and a spinbox. The time part works fine separately, and it does get the spinbox info ok.   
def go(self):
        def time():
            e1= entry1.get()
            e2= entry2.get()
            run_time_min= float(e1)
            run_time_sec= float(e2)
            time= run_time_min * 60 + run_time_sec
            return time
        
        def calc():
            sb1 = spinbox1.get()
            if sb1 == '8mm':
                feet=time/fpsecs8
                print feet
            elif sb1 == 'Super 8':
                feet= time/fpsecss8
                print feet
            elif sb1 == '16mm':
                feet= time/fpsecs16
                print feet
            elif sb1 == '16 Sound':
                feet= time/fpsecs16s
                print feet
Reply


Messages In This Thread
Arguments in function for button command - by kristrek - Jan-04-2017, 04:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Button 'command' Argument Confusion gw1500se 11 5,693 Nov-11-2021, 08:45 PM
Last Post: menator01
  Creating a function interrupt button tkinter AnotherSam 2 5,421 Oct-07-2021, 02:56 PM
Last Post: AnotherSam
  [Tkinter] Have tkinter button toggle on and off a continuously running function AnotherSam 5 4,921 Oct-01-2021, 05:00 PM
Last Post: Yoriz
  Get name of command button Heyjoe 3 2,239 Dec-10-2020, 04:30 AM
Last Post: deanhystad
  Class function does not create command button Heyjoe 2 2,230 Aug-22-2020, 08:06 PM
Last Post: Heyjoe
  [Tkinter] Command button, then more command buttons Heyjoe 4 2,820 Aug-08-2020, 11:28 AM
Last Post: Yoriz
  [Tkinter] button command tkinter Heyjoe 6 5,006 Jul-30-2020, 07:06 PM
Last Post: deanhystad
  Button Command Heyjoe 4 2,306 Jul-20-2020, 01:45 AM
Last Post: Heyjoe
  Passing arguments into function, tkinter nanok66 3 4,876 Apr-18-2020, 11:53 PM
Last Post: nanok66
  Tkinter:Unable to bind and unbind function with a button shallanq 2 4,969 Mar-28-2020, 02:05 AM
Last Post: joe_momma

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020