pedram
pedram

Reputation: 3087

Can I access attributes of my wxpython frame from the IDLE Console?

Let's say I have a frame

class Frame(wx.Frame):
def __init__(self, *args, **kwargs):
    super(Frame, self).__init__(*args, **kwargs)

    self.InitUI()
    self.SetSize((380,340))
    self.Show()
    self.something = 0

Which I start like so:

if __name__ == '__main__':
    app = wx.App()
    frame = Frame(None)
    app.MainLoop()

And during debugging I find a bug I think is related to self.something. Can I view the contents self.something through IDLE's Console?

Upvotes: 0

Views: 101

Answers (2)

Steve Barnes
Steve Barnes

Reputation: 28370

For you would find it worth looking for an IDE with built in debugger, there are several good free ones.

Alternatively you could use winpdb this would give you a full debugger as a standalone and it works fine with wxPython.

It is also worth looking at the python documents on debugging as you can open a debug console from within your code.

There is also the wx inspection tool, in your code try:

import wx.lib.inspection
wx.lib.inspection.InspectionTool().Show()

enter image description here

Upvotes: 1

Mike Driscoll
Mike Driscoll

Reputation: 33071

I doubt it. You need some kind of debugger that can pause the main process so you can take a look under the hood. I've heard that PyDev/Eclipse works and I know WingWare's IDE has a debugger that works with wx as I use it all the time. I haven't found any hard data about whether or not Python debugger (pdb) can attach itself to wx or not.

You might find the following threads useful though:

Upvotes: 1

Related Questions