User avatar
RogerW
Posts: 284
Joined: Sat Dec 20, 2014 12:15 pm
Location: London UK

Thonny complains object has no attribute '_w'

Fri Nov 30, 2018 3:11 pm

I have a simple tkinter program to try out Thonny 3 debug.

Code: Select all

import tkinter as tk

class Mainframe(tk.Frame):
    def __init__(self,master,*args,**kwargs):
        tk.Frame.__init__(self,master,*args,**kwargs)
     
class App(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self)
        self.title('Simple test')
        self.geometry('300x100')
      
        Mainframe(self).pack()
        
        self.mainloop()
                    
App()
When I try to debug by pressing the over button I eventually get the message
AttributeError: 'Mainframe' object has no attribute '_w'

A google search only came up with the suggestion that the base class is not being called - but it is. Is this a bug or am I missing something?

User avatar
MrYsLab
Posts: 353
Joined: Mon Dec 15, 2014 7:14 pm
Location: Noo Joysey, USA

Re: Thonny complains object has no attribute '_w'

Fri Nov 30, 2018 4:20 pm

I believe you found a bug in Thonny. I just ran your code in Debug mode using the mu-editor, stepping through each line and it works without error.
I also ran it on an Ubuntu box using the Pycharm debugger, and it works fine as well. I tried using Thonny and I am seeing the same error as you.

Return to “Python”