[wxPython] wxTreeCtrl difficulties

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] wxTreeCtrl difficulties

Trey Gregory
Hi all. I'm having some trouble with wxTreeCtrl. I basically have
followed the exact example given in pyTree, except for the fact that
the calling program is not demo.py, but my own program. I execute the
following code:


def runTest(frame):
    """
    This method is used by the wxPython Demo Framework for integrating
    this demo with the rest.
    """
    thisModule = __import__(__name__, globals())
    win = wx.wxFrame(frame, -1, "PyTreeItemData Test")
    split = wx.wxSplitterWindow(win, -1)
    tree = pyTree(split, -1, thisModule)
    text = wx.wxTextCtrl(split, -1, "", wx.wxDefaultPosition,
                         wx.wxDefaultSize, wx.wxTE_MULTILINE)
    split.SplitVertically(tree, text, 200)

    tree.SetOutput(text.SetValue)
    tree.SelectItem(tree.root)    # freezes on this call
    win.SetSize(wx.wxSize(800,500))
    frame.otherWin = win
    win.Show(1)

The class pyTree is literally unchanged from the latest release. The
program "freezes" at the SelectItem call. I'm on Windows NT 4.0 SP4 if
that makes a difference.

runTest is called from an event handler which is within a wxPanel (on
the other window). I've tried passing the wxPanel object and the
wxFrame object which holds it to runTest with similar results.

What am I overlooking? Thanks for all the help!

Trey

=====

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxTreeCtrl difficulties

Robin Dunn
> Hi all. I'm having some trouble with wxTreeCtrl. I basically have
> followed the exact example given in pyTree, except for the fact that
> the calling program is not demo.py, but my own program. I execute the
> following code:
>

Are you running it from a console window so you can see if there are any
exceptions happening?  If so is there a traceback?  If not, please try it
from a console.

What happens if you comment out the SelectItem call?

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxTreeCtrl difficulties

Trey Gregory
In reply to this post by Trey Gregory
I'm running it from a console. There are no exceptions. If I comment
out the SelectItem call the code will work up until the point where an
OnItemCollapsed event is processed in this routine:

    def OnItemCollapsed(self, event):
        """
        We need to remove all children here, otherwise we'll see all
        that old rubbish again after the next expansion.
        """

        print 'OnItemCollapsed'
        item = event.GetItem()
        self.DeleteChildren(item)
        print 'OnItemCollapsed done'

It hangs on DeleteChildren. No exceptions are output in this case
either. Other events like ItemExpanding and SelectionChanged process
properly. Is there a debugging flag that I could enable in wxPython
perhaps?

Thanks,
trey


--- Robin Dunn <[hidden email]> wrote:

> > Hi all. I'm having some trouble with wxTreeCtrl. I basically have
> > followed the exact example given in pyTree, except for the fact
> that
> > the calling program is not demo.py, but my own program. I execute
> the
> > following code:
> >
>
> Are you running it from a console window so you can see if there are
> any
> exceptions happening?  If so is there a traceback?  If not, please
> try it
> from a console.
>
> What happens if you comment out the SelectItem call?
>
> --
> Robin Dunn
> Software Craftsman
> [hidden email]
> http://AllDunn.com/robin/
> http://AllDunn.com/wxPython/  Check it out!
>
>
>


=====

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxTreeCtrl difficulties

Robin Dunn
> I'm running it from a console. There are no exceptions. If I comment
> out the SelectItem call the code will work up until the point where an
> OnItemCollapsed event is processed in this routine:
>
[...]
>
> It hangs on DeleteChildren. No exceptions are output in this case
> either. Other events like ItemExpanding and SelectionChanged process
> properly.

I'm afraid you've stumped me...  If you want to zip up your sources and send
them to me I'll take a closer look.

> Is there a debugging flag that I could enable in wxPython
> perhaps?
>

Not unless you want to recompile wxPython and wxWindows in debug mode,
(which is how I'll run it.)  There may be an assert or something that will
be helpful.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users