Python Forum
Stop import from executing function, but allow the function to execute from tk btn.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stop import from executing function, but allow the function to execute from tk btn.
#4
As I expected - you call the function when you assign it as a callback

command=add_book(None) should be just command=add_book

As a side note - your code is really poorly organized (real spaghetti code - no offence)
the use of global variables is considered bad practice, you declare them global all over the place, you mix the logic and the gui, etc.
you really need to rethink how your code is organized.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: Stop import from executing function, but allow the function to execute from tk btn. - by buran - Dec-08-2020, 09:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Call local variable of previous function from another function with Python3 & tkinter Hannibal 5 4,431 Oct-12-2020, 09:16 PM
Last Post: deanhystad
  [Tkinter] Tkinter - I have problem after import varaible or function from aGUI to script johnjh 2 2,581 Apr-17-2020, 08:12 PM
Last Post: johnjh
  [Tkinter] Not able to use the output from one function into another function AravindPandian 1 1,640 Oct-17-2019, 08:40 AM
Last Post: Evil_Patrick
  [Tkinter] Button won't execute function TheLegendOfPanda 2 3,071 Jul-05-2019, 07:41 PM
Last Post: TheLegendOfPanda
  Stop Watch star/stop problem macellan85 1 2,562 Jun-12-2019, 06:04 PM
Last Post: woooee
  How to stop a tkinter function, without closing the window? keakins 5 13,064 Jun-29-2017, 11:53 AM
Last Post: keakins

Forum Jump:

User Panel Messages

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