Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code execution after event
#1
i am very new to Python. I'm a .NET programmer but want to get into Python so I can write cross-platform code that will work on Windows as well as Linux based OS'.

I have coded a GUI python form for some testing with various buttons, combo boxes and check buttons.

I want to be able to execute specific code say if a button is selected or a value is selected.

Can someone point me to somewhere to read up on how to do this or give me some direction.

Thank you,
SHIFT838
http://shift838.99er.net

Telnet BBS:
fusionbbs.ddns.net:9640
Reply
#2
Quote:I have coded a GUI
which GUI package?
Reply
#3
(Nov-25-2018, 10:09 PM)Larz60+ Wrote:
Quote:I have coded a GUI
which GUI package?

tkinter
Reply
#4
Although this document is rather old, It's still the best (In my opinion) tkinter reference: http://infohost.nmt.edu/tcc/help/pubs/tk...index.html pdf version: http://www.nmt.edu/tcc/help/pubs/tkinter/tkinter.pdf.

There's also now: https://docs.python.org/3/library/tk.html which I haven't really reviewed, but looks to be very complete, and what's more, new. Looks like it might be a better choice.

As far as executing specific code when a button is pushed, you need to look up event processing. There are a couple of ways of doing it, simplest is using control in the Button definition, most powerful is by using bind: http://infohost.nmt.edu/tcc/help/pubs/tk...vents.html or https://docs.python.org/3/library/tkinte...and-events .
You can use lambda on the control version to add arguments, but bind still provides more flexibility.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Different code execution times Wirbelwind94 4 764 Oct-06-2023, 12:30 PM
Last Post: snippsat
  In consistency in code execution Led_Zeppelin 1 1,120 Jun-27-2022, 03:00 AM
Last Post: deanhystad
  Minimizing the CMD window during code execution Shaswat 1 4,605 Oct-03-2019, 07:44 AM
Last Post: Shaswat
  How to Make Python code execution pause and resume to create .csv and read values. Kashi 2 3,777 Jun-14-2018, 04:16 PM
Last Post: DeaD_EyE
  Another working code, help required for faster multithreading execution anna 0 2,263 Feb-09-2018, 03:26 AM
Last Post: anna
  Help required for faster execution of working code anna 2 3,160 Feb-09-2018, 03:00 AM
Last Post: anna
  code to understand the script execution Skaperen 2 3,360 Jan-06-2018, 05:25 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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