Python Forum
Tkinter object scope
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter object scope
#3
The solution is to make the widgets that you want to access later members of the EnterBookWindow instance, for example in __init__()
self.entBookTitle = ttk.Entry(...)
Later
    def SaveBook(self):
        book = Book(
            self.entBookTitle.get(), self.entBookISBN.get(), self.entBookAuthor.get(), self.entBookYear.get())
Don't use the global keyword. It generally means that you are not organizing the data correctly.
Reply


Messages In This Thread
Tkinter object scope - by riversr54 - Feb-16-2023, 07:40 PM
RE: Tkinter object scope - by riversr54 - Feb-16-2023, 07:41 PM
RE: Tkinter object scope - by Gribouillis - Feb-16-2023, 07:55 PM
RE: Tkinter object scope - by riversr54 - Feb-16-2023, 08:14 PM
RE: Tkinter object scope - by Gribouillis - Feb-16-2023, 08:54 PM
RE: Tkinter object scope - by riversr54 - Feb-16-2023, 09:19 PM
RE: Tkinter object scope - by deanhystad - Feb-17-2023, 05:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter AttributeError: 'GUI' object has no attribute pfdjhfuys 3 1,789 May-18-2023, 03:30 PM
Last Post: pfdjhfuys
  Key Binding scope angus1964 1 1,290 Jun-30-2022, 08:17 PM
Last Post: deanhystad
  tkinter moving an class object with keybinds gr3yali3n 5 3,453 Feb-10-2021, 09:13 PM
Last Post: deanhystad
  Scope of variable when using two classes AyJay 2 2,233 Jan-23-2020, 10:09 AM
Last Post: AyJay

Forum Jump:

User Panel Messages

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