Python Forum
[Tkinter] How to find what causing AttributeError: '_tkinter.tkapp' ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to find what causing AttributeError: '_tkinter.tkapp' ?
#9
I see this is a continuation from this post
I suggest that you don't inherit SampleApp but instead pass an instance of SampleApp to PageOne.

This is an example of what you are trying to do
class Frame:
 
    def __init__(self):
        print('Frame')
 
 
class SampleApp:
 
    def __init__(self):
        print('SampleApp')
        self.oppna_data_filer()
        PageOne()
         
    def oppna_data_filer(self):
        self.file1 = 'file1'
 
 
class PageOne(Frame, SampleApp):
 
    def __init__(self):
        Frame.__init__(self)
        print('PageOne')
        print(self.file1)
 
one = SampleApp()
which will give
SampleApp
Frame
PageOne
AttributeError: 'PageOne' object has no attribute 'file1'
This is an example of how it would look passing PageOne the instance of SimpleApp

class Frame:
  
    def __init__(self):
        print('Frame')
  
  
class SampleApp:
  
    def __init__(self):
        print('SampleApp')
        self.oppna_data_filer()
        PageOne(self)
          
    def oppna_data_filer(self):
        self.file1 = 'file1'
  
  
class PageOne(Frame):
  
    def __init__(self, sample_app):
        Frame.__init__(self)
        print('PageOne')
        self.sample_app = sample_app
        print(self.sample_app.file1)
  
one = SampleApp()
which will give
SampleApp
Frame
PageOne
file1
P.S. Class Intermediate: Inheritance
Reply


Messages In This Thread
RE: How to find what causing AttributeError: '_tkinter.tkapp' ? - by Yoriz - Sep-18-2016, 11:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] _tkinter.TclError: can't invoke "destroy" command: application has been destroyed knoxvilles_joker 6 15,274 Apr-25-2021, 08:41 PM
Last Post: knoxvilles_joker
  [Tkinter] _tkinter.TclError: bitmap "Icon.gif" not defined djwilson0495 2 12,860 Aug-05-2020, 02:27 PM
Last Post: wuf
  [Tkinter] _tkinter.TclError: image "pyimage2" doesn't exist Killdoz 1 10,515 May-30-2020, 09:48 AM
Last Post: menator01
  AttributeError: '_tkinter.tkapp' object has no attribute 'place_forget' edphilpot 5 9,107 Dec-20-2019, 09:52 PM
Last Post: joe_momma
  "ModuleNotFoundError: No module named '_tkinter' in Python 3.8 Alfa 0 programmerc 1 6,283 Oct-21-2018, 06:32 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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