Python Forum
[Tkinter] Extrakt a Variable from a closed tkinter window
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Extrakt a Variable from a closed tkinter window
#6
If you want to access a variable after the tkinter window closes, then you have to make it an instance object. Snipped version of your code
        def change_dropdown(*args):
           self.remaining_variable=self.tkvar.get()
           print(self.tkvar.get() )
            
        # link function to change dropdown
        self.tkvar.trace('w', change_dropdown)
 
 
master = tkinter.Tk()
master.title("Sheetauswahl") 
app = App(master)
master.mainloop()
 
## app=instance,  App=class
## app remains until you destroy it or close the program
print(app.remaining_variable)
sheet = app.remaining_variable
df = pd.read_excel(Filename, sheet_name=sheet)
Reply


Messages In This Thread
RE: Extrakt a Variable from a closed tkinter window - by woooee - Aug-23-2019, 09:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 532 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  [closed] "checked" variable (attribute?) origin? paul18fr 4 546 Mar-05-2024, 04:20 PM
Last Post: deanhystad
  [Tkinter] (CLOSED) CTkScrollableDropdown error: bad window path name ".!ctkscrollabledropdown" CopperGenie 4 622 Mar-03-2024, 03:21 AM
Last Post: CopperGenie
  pass a variable between tkinter and toplevel windows janeik 10 2,374 Jan-24-2024, 06:44 AM
Last Post: Liliana
  Tkinter multiple windows in the same window tomro91 1 866 Oct-30-2023, 02:59 PM
Last Post: Larz60+
  Centering and adding a push button to a grid window, TKinter Edward_ 15 4,888 May-25-2023, 07:37 PM
Last Post: deanhystad
  [Tkinter] Open tkinter colorchooser at toplevel (so I can select/focus on either window) tabreturn 4 1,924 Jul-06-2022, 01:03 PM
Last Post: deanhystad
  [Tkinter] Background inactivity timer when tkinter window is not active DBox 4 2,939 Apr-16-2022, 04:04 PM
Last Post: DBox
  why my list changes to a string as I move to another window in tkinter? pymn 4 2,584 Feb-17-2022, 07:02 AM
Last Post: pymn
  [Tkinter] Tkinter Window Has no Title Bar gw1500se 4 2,870 Nov-07-2021, 05:14 PM
Last Post: gw1500se

Forum Jump:

User Panel Messages

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