Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Conditional Button Press
#3
Have you tried using an intermediate variable?

I don't know what framework you're using, so here's some pseudopython
class Button:
   def __init__(self):
       self.clicked = False
   def click(self):
       self.clicked = True

btn = Button()
gui_framework.CreateButton().onclick(btn.click)
while not btn.clicked:
   time.sleep(0.1) # so you don't melt your computer :)
Reply


Messages In This Thread
Conditional Button Press - by Raudert - Mar-16-2017, 08:54 PM
RE: Conditional Button Press - by micseydel - Mar-16-2017, 09:10 PM
RE: Conditional Button Press - by nilamo - Mar-16-2017, 09:11 PM
RE: Conditional Button Press - by Raudert - Mar-17-2017, 01:18 PM
RE: Conditional Button Press - by Larz60+ - Mar-17-2017, 01:31 PM
RE: Conditional Button Press - by Raudert - Mar-17-2017, 01:47 PM
RE: Conditional Button Press - by Larz60+ - Mar-17-2017, 01:51 PM
RE: Conditional Button Press - by Raudert - Mar-17-2017, 02:06 PM
RE: Conditional Button Press - by Larz60+ - Mar-17-2017, 07:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to break out of a for loop on button press? philipbergwerf 6 1,999 Oct-06-2022, 03:12 PM
Last Post: philipbergwerf
  tkinter auto press button kucingkembar 2 3,431 Dec-24-2021, 01:23 PM
Last Post: kucingkembar

Forum Jump:

User Panel Messages

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