Python Forum
[Tkinter] Button won't execute function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Button won't execute function
#3
(Jul-05-2019, 07:33 PM)Yoriz Wrote: Your class is is not a proper class it just has functions that aside
okp = tk.Button(root,text='OK', font=(15), fg='white', bg='black', command=ShipPlacementPlayer.placement())
command should be passed a callable that it can call when a button is pressed, you need to remove the () from ShipPlacementPlayer.placement so the button press can do the call itself.
Thank you so much! Now I feel stupid for asking such a simple question. Anyways if a change that do you know why you need to press to times 'ok' when the ships left get to 1?
Reply


Messages In This Thread
Button won't execute function - by TheLegendOfPanda - Jul-05-2019, 07:24 PM
RE: Button won't execute function - by Yoriz - Jul-05-2019, 07:33 PM
RE: Button won't execute function - by TheLegendOfPanda - Jul-05-2019, 07:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating a function interrupt button tkinter AnotherSam 2 5,412 Oct-07-2021, 02:56 PM
Last Post: AnotherSam
  [Tkinter] Have tkinter button toggle on and off a continuously running function AnotherSam 5 4,917 Oct-01-2021, 05:00 PM
Last Post: Yoriz
  Stop import from executing function, but allow the function to execute from tk btn. MrBitPythoner 4 2,624 Dec-08-2020, 10:00 PM
Last Post: MrBitPythoner
  Class function does not create command button Heyjoe 2 2,223 Aug-22-2020, 08:06 PM
Last Post: Heyjoe
  Tkinter:Unable to bind and unbind function with a button shallanq 2 4,963 Mar-28-2020, 02:05 AM
Last Post: joe_momma
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 4,947 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  [Tkinter] How make a button perform a function after the user inputs numbers Zephyrforce 1 2,413 May-22-2019, 05:43 PM
Last Post: woooee
  [Kivy] Chagne a button's function after its first pressed TheStraying11 2 5,030 Feb-17-2019, 06:16 PM
Last Post: Yoriz
  [Tkinter] assigning two function for a single button prawesh05 3 5,017 Jan-16-2019, 10:39 PM
Last Post: Larz60+
  Unable to return value from callback function of a button in Python Tkinter nilaybnrj 4 20,696 Aug-05-2018, 11:01 PM
Last Post: woooee

Forum Jump:

User Panel Messages

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