wxCallAfter & responsiveness

I have a method in a subclass of a control that does some background
processing. It does one chunk of work and then invokes itself with
wxCallAfter(). It works except that the GUI becomes *completely*
unresponsive as the method blasts through its work. It's along these
lines:

  def doTasks(self, taskID, index=0):
      if taskSetID is self.taskSetID and index<self.numTasks:
          self.doTask(index)
          wxCallAfter(self.doTasks, taskSetID, index+1)

In a nutshell, I'm wondering how to get the GUI to be responsive. Some
dead ends:

* Putting a wxYield() at the top or just before wxCallAfter eventually
results in a wxWindows error about wxYield being invoked recursively.

* wxSafeYield() is not an option as I want the entire GUI to work.

* The LongRunningTasks wiki shows the use of posting events, but
wxCallAfter is already just a fancy wrapper for wxPostEvent (I
confirmed by reading wx.py) so the techniques should be equivalent.

* I tried a non-CallAfter approach which involved looping over the work
and invoke wxYield(). Eventually that gives the recursive error as
well.

* I checked the docs to see if I could give events "low priority", but
didn't see anything.

* And here's the stake in the heart: I can't put the work in a thread
(where I could time.sleep() 1/10th of a second), because the work uses
wxBitmap which causes Xlib async errors when not used in the main
thread. :slight_smile:

I'm on wxPython 2407, Python 222, Mandrake Linux 90. I haven't distilled
this down to a minimal example yet.

Any suggestions?

···

--
Chuck
http://ChuckEsterbrook.com

Chuck Esterbrook wrote:

* Putting a wxYield() at the top or just before wxCallAfter eventually
results in a wxWindows error about wxYield being invoked recursively.

From the docs:

wxApp::Yield

bool Yield(bool onlyIfNeeded = FALSE)

...

Calling Yield() recursively is normally an error and an assert failure
is raised in debug build if such situation is detected. However if the
the onlyIfNeeded parameter is TRUE, the method will just silently return
FALSE instead.

So you can do:

wxGetApp().Yield(True)

I don't know if that will help you, but it's worked great for me. Note
that the wxYield() global function has been depricated, in favor of
wxApp.Yield(), and it doesn't take the onlyIfNeeded parameter.

-Chris

-- --
Christopher Barker, Ph.D.
Oceanographer
                                                
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Chuck Esterbrook wrote:

I have a method in a subclass of a control that does some background processing. It does one chunk of work and then invokes itself with wxCallAfter(). It works except that the GUI becomes *completely* unresponsive as the method blasts through its work. It's along these lines:

def doTasks(self, taskID, index=0):
     if taskSetID is self.taskSetID and index<self.numTasks:
         self.doTask(index)
         wxCallAfter(self.doTasks, taskSetID, index+1)

Put this in an OnIdle handler, something like this:

def OnIdle(self, event):
    if self.index < self.numTasks:
        self.doTask(self.index)
        self.index += 1
        event.RequestMore()

Every time your message queue empties, you will have an idle event fired. If you call event.RequestMore(), then you'll get another idle event if the message queue is still empty, but idle events remain lower priority than other events. This means that your GUI will respond fairly normally (a command event triggered during idle processing will be handled as soon as that one idle event finishes), but the idle task will keep processing as long as there are no other messages. Naturally, the shorter you can make each segment of idle handling, the more responsive the GUI will be.

Jeff Shannon
Technician/Programmer
Credit International

Chuck Esterbrook wrote:

I have a method in a subclass of a control that does some background processing. It does one chunk of work and then invokes itself with wxCallAfter(). It works except that the GUI becomes *completely* unresponsive as the method blasts through its work. It's along these lines:

  def doTasks(self, taskID, index=0):
      if taskSetID is self.taskSetID and index<self.numTasks:
          self.doTask(index)
          wxCallAfter(self.doTasks, taskSetID, index+1)

In a nutshell, I'm wondering how to get the GUI to be responsive. Some dead ends:

* Putting a wxYield() at the top or just before wxCallAfter eventually results in a wxWindows error about wxYield being invoked recursively.

I haven't used wxYield much, so I'll let someone else comment on this.

* The LongRunningTasks wiki shows the use of posting events, but wxCallAfter is already just a fancy wrapper for wxPostEvent (I confirmed by reading wx.py) so the techniques should be equivalent.

Except that LongRunningTasks doesn't just use events, it uses a separate thread, and then uses events to send results back to the main thread. Your call to wxCallAfter will post a new event every time doTasks is invoked, so you get events one after another in rapid succession. There isn' much chance for a user-interface event to get into the queue before this new event.

* I tried a non-CallAfter approach which involved looping over the work and invoke wxYield(). Eventually that gives the recursive error as well.

This sounds like a much simpler approach than the one you show above. Again, someone with more knowledge of wxYield will have to comment (but would probably need to see that code to do so).

* And here's the stake in the heart: I can't put the work in a thread (where I could time.sleep() 1/10th of a second), because the work uses wxBitmap which causes Xlib async errors when not used in the main thread. :slight_smile:

Does the work actually use wxBitmap, or does it do some work and then display the results in a bitmap? If the latter, you can do the work in a separate thread, and then use events to send the results back to the main thread for display.

David

David C. Fox wrote:

Chuck Esterbrook wrote:

I have a method in a subclass of a control that does some background processing. It does one chunk of work and then invokes itself with wxCallAfter(). It works except that the GUI becomes *completely* unresponsive as the method blasts through its work. It's along these lines:

  def doTasks(self, taskID, index=0):
      if taskSetID is self.taskSetID and index<self.numTasks:
          self.doTask(index)
          wxCallAfter(self.doTasks, taskSetID, index+1)

In a nutshell, I'm wondering how to get the GUI to be responsive. Some dead ends:

* Putting a wxYield() at the top or just before wxCallAfter eventually results in a wxWindows error about wxYield being invoked recursively.

I haven't used wxYield much, so I'll let someone else comment on this.

Every time I've used wxYield I end up ripping it out for exactly this reason. I'd avoid that approach.

For a somewhat similar problem I've used OnIdle with some success, similar to this:

   def __init___(...):
      #....
      wx.EVT_IDLE(self, self.OnIdle)

    def DoTasks(self):
         self.index = 0
         wx.wxWakeUpIdle()

    def OnIdle(self, event):
        if self.index < self.numTasks:
            self.doTask(self.index)
            self.index += 1
            event.RequestMore()

My particular application is a bit different, so I'm not sure if this exact code will work, but hopefully this will be helpful.

-tim

···

* The LongRunningTasks wiki shows the use of posting events, but wxCallAfter is already just a fancy wrapper for wxPostEvent (I confirmed by reading wx.py) so the techniques should be equivalent.

Except that LongRunningTasks doesn't just use events, it uses a separate thread, and then uses events to send results back to the main thread. Your call to wxCallAfter will post a new event every time doTasks is invoked, so you get events one after another in rapid succession. There isn' much chance for a user-interface event to get into the queue before this new event.

* I tried a non-CallAfter approach which involved looping over the work and invoke wxYield(). Eventually that gives the recursive error as well.

This sounds like a much simpler approach than the one you show above. Again, someone with more knowledge of wxYield will have to comment (but would probably need to see that code to do so).

* And here's the stake in the heart: I can't put the work in a thread (where I could time.sleep() 1/10th of a second), because the work uses wxBitmap which causes Xlib async errors when not used in the main thread. :slight_smile:

Does the work actually use wxBitmap, or does it do some work and then display the results in a bitmap? If the latter, you can do the work in a separate thread, and then use events to send the results back to the main thread for display.

David

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

I went with the idle approach. My app is now behaving in a friendly
manner to users. Thanks to all who responded. I found the notes about
wxGetApp().Yield(True) interesting, too.

One odd thing is that my onIdle() handler will sometimes get called 15
or so times very quickly even though it doesn't RequestMore(). Wait...I
just figured out that it gets called as I move the mouse. I guess the
act of the event queue going empty causes the idle handlers to get
called. Seems reasonable to me, except that one quick jerk of the mouse
results in about 10-15 calls rather than just 1.

Hmmm, I guess I'll try to disconnect the IDLE event when I'm out of work
and connect it before wxWakeUpIdle().

Do you do this, Tim?

Thanks for everyone's help!

···

On Thursday 17 April 2003 03:53 pm, Tim Hochberg wrote:

Every time I've used wxYield I end up ripping it out for exactly this
reason. I'd avoid that approach.

For a somewhat similar problem I've used OnIdle with some success,
similar to this:

   def __init___(...):
      #....
      wx.EVT_IDLE(self, self.OnIdle)

    def DoTasks(self):
         self.index = 0
         wx.wxWakeUpIdle()

    def OnIdle(self, event):
        if self.index < self.numTasks:
            self.doTask(self.index)
            self.index += 1
            event.RequestMore()

My particular application is a bit different, so I'm not sure if this
exact code will work, but hopefully this will be helpful.

--
Chuck
http://ChuckEsterbrook.com

On windows I can look at the wxSplitter example code
but I can't run. I would like to use splitter. Does anyone have a simple
working example code of wxSplitter ??

Chuck Esterbrook wrote:

One odd thing is that my onIdle() handler will sometimes get called 15 or so times very quickly even though it doesn't RequestMore(). Wait...I just figured out that it gets called as I move the mouse. I guess the act of the event queue going empty causes the idle handlers to get called.

Exactly.

Hmmm, I guess I'll try to disconnect the IDLE event when I'm out of work and connect it before wxWakeUpIdle().

Better yet, just put a flag in your idle handler that indicates whether there's work to be done or not. The overhead involved in your handler firing, determining there's no work, and exiting, is fairly insignificant and can be ignored. Toggling that flag will be a lot simpler than connecting and disconnecting the handler.

Jeff Shannon
Technician/Programmer
Credit International

I made something it should work but when I start it I get a message from
windows that python has encountered problemes ..
Here's the code

<-- code -->

from wxPython.wx import *
f = wxFrame(NULL,-1,"hello",size=(200,300))
s = wxSplitterWindow(f,-1)
s.SplitVertically(wxWindow(s,-1),wxWindow(s,-1))
f.Show(1)

···

----- Original Message -----
From: "Jonas Geiregat" <kemu@sdf-eu.org>
To: <wxPython-users@lists.wxwindows.org>
Sent: Friday, April 18, 2003 2:08 AM
Subject: [wxPython-users] wxSplitter example code ?

On windows I can look at the wxSplitter example code
but I can't run. I would like to use splitter. Does anyone have a simple
working example code of wxSplitter ??

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Chuck Esterbrook wrote:

I went with the idle approach. My app is now behaving in a friendly manner to users. Thanks to all who responded. I found the notes about wxGetApp().Yield(True) interesting, too.

I forgot about that. That calls Yield, but keeps it from being called recursively, right? I think that either showed up recently in wxPython, or I just couldn't find it when I was fighting with Yield. It's seems unfortunate that the onlyIfNeeded flag doesn't default to True and that this behaviour isn't available in the regular wxYield.

One odd thing is that my onIdle() handler will sometimes get called 15 or so times very quickly even though it doesn't RequestMore(). Wait...I just figured out that it gets called as I move the mouse. I guess the act of the event queue going empty causes the idle handlers to get called. Seems reasonable to me, except that one quick jerk of the mouse results in about 10-15 calls rather than just 1.

Hmmm, I guess I'll try to disconnect the IDLE event when I'm out of work and connect it before wxWakeUpIdle().

Do you do this, Tim?

No, I've never noticed it to be a performance problem, so I haven't been motivated. Not much happens in OnIdle if there's nothing to do since it's guarded by "self.index < self.numTasks" or something similar. I did notice the behaviour your talking about though, but from the other direction. When I started with this I didn't realize that WakeUpIdle was necessary (sometimes, anyway), so nothing would happen until I moved the mouse, then my task would wake up and run. It was quite mystifying for a while.

Thanks for everyone's help!

I'm glad it was useful!

-tim

class wxMediaExplorerFrame(wxFrame):
    def __init__(self, *args, **kwds):
        wxFrame.__init__(self, *args, **kwds)
        
        self.mt = wxPanel (self.splitter,-1)
        self.ie = wxPanel (self.splitter,-1)
        self.splitter.SplitVertically(self.mt, self.ie, 300)

if __name__ == "__main__":
    class MyApp(wxApp):
        def OnInit(self):
            frame_1 = wxMediaExplorerFrame(None, -1,"")
            frame_1.Show(1)
            return 1
  
    app = MyApp()
    app.MainLoop()

when i run it I get the following message
NameError: name 'wxFrame' is not defined

···

----- Original Message -----
From: "Ben Allfree" <benles@bldigital.com>
To: <wxPython-users@lists.wxwindows.org>
Sent: Friday, April 18, 2003 2:59 AM
Subject: RE: [wxPython-users] wxSplitter code fragment

class wxMediaExplorerFrame(wxFrame):
    def __init__(self, *args, **kwds):
        wxFrame.__init__(self, *args, **kwds)
        
        self.mt = wxPanel (self.splitter,-1)
        self.ie = wxPanel (self.splitter,-1)
        self.splitter.SplitVertically(self.mt, self.ie, 300)

if __name__ == "__main__":
    class MyApp(wxApp):
        def OnInit(self):
            frame_1 = wxMediaExplorerFrame(None, -1,"")
            frame_1.Show(1)
            return 1
  
    app = MyApp()
    app.MainLoop()

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

it still doesn't work

02:54:35 Debug: e:\projects\wx\src\msw\app.cpp(439) unregisterClass(canvas)
failed with error 0x00000584 (class ls has open windows)
.....

···

----- Original Message -----
From: "Ben Allfree" <benles@bldigital.com>
To: <wxPython-users@lists.wxwindows.org>
Sent: Friday, April 18, 2003 2:59 AM
Subject: RE: [wxPython-users] wxSplitter code fragment

class wxMediaExplorerFrame(wxFrame):
    def __init__(self, *args, **kwds):
        wxFrame.__init__(self, *args, **kwds)

        self.mt = wxPanel (self.splitter,-1)
        self.ie = wxPanel (self.splitter,-1)
        self.splitter.SplitVertically(self.mt, self.ie, 300)

if __name__ == "__main__":
    class MyApp(wxApp):
        def OnInit(self):
            frame_1 = wxMediaExplorerFrame(None, -1,"")
            frame_1.Show(1)
            return 1

    app = MyApp()
    app.MainLoop()

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Oh ca'mon :slight_smile:

from wxPython.wx import *

···

-----Original Message-----
From: Jonas Geiregat [mailto:kemu@sdf-eu.org]
Sent: Thursday, April 17, 2003 5:54 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] wxSplitter code fragment

when i run it I get the following message
NameError: name 'wxFrame' is not defined

----- Original Message -----
From: "Ben Allfree" <benles@bldigital.com>
To: <wxPython-users@lists.wxwindows.org>
Sent: Friday, April 18, 2003 2:59 AM
Subject: RE: [wxPython-users] wxSplitter code fragment

> class wxMediaExplorerFrame(wxFrame):
> def __init__(self, *args, **kwds):
> wxFrame.__init__(self, *args, **kwds)
>
> self.mt = wxPanel (self.splitter,-1)
> self.ie = wxPanel (self.splitter,-1)
> self.splitter.SplitVertically(self.mt, self.ie, 300)
>
> if __name__ == "__main__":
> class MyApp(wxApp):
> def OnInit(self):
> frame_1 = wxMediaExplorerFrame(None, -1,"")
> frame_1.Show(1)
> return 1
>
> app = MyApp()
> app.MainLoop()
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

I think wxPython comes with a full splitter example

···

-----Original Message-----
From: Jonas Geiregat [mailto:kemu@sdf-eu.org]
Sent: Thursday, April 17, 2003 5:57 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] wxSplitter code fragment

it still doesn't work

02:54:35 Debug: e:\projects\wx\src\msw\app.cpp(439)
unregisterClass(canvas)
failed with error 0x00000584 (class ls has open windows)
.....

----- Original Message -----
From: "Ben Allfree" <benles@bldigital.com>
To: <wxPython-users@lists.wxwindows.org>
Sent: Friday, April 18, 2003 2:59 AM
Subject: RE: [wxPython-users] wxSplitter code fragment

> class wxMediaExplorerFrame(wxFrame):
> def __init__(self, *args, **kwds):
> wxFrame.__init__(self, *args, **kwds)
>
> self.mt = wxPanel (self.splitter,-1)
> self.ie = wxPanel (self.splitter,-1)
> self.splitter.SplitVertically(self.mt, self.ie, 300)
>
> if __name__ == "__main__":
> class MyApp(wxApp):
> def OnInit(self):
> frame_1 = wxMediaExplorerFrame(None, -1,"")
> frame_1.Show(1)
> return 1
>
> app = MyApp()
> app.MainLoop()
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Hi All,

How do you translate something like this to Python:

    m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(newsrc);

...where Parse() returns a wxObject.

This is from the wxHtmlDCRenderer. I'm trying to do something to get a
::SetFonts method in it like wxHtmlWindow::SetFonts.

I figured I'd write it in Python, but some of the functions in
wxHtmlDCRenderer return wxObject pointers that need to be cast to a certain
type, and I don't know how to do that.

I don't know what I'm doing wrong here,
I try to add a TreeCtrl and a wxIEHtmlWin in a splitterwindow
it won't work if I replace the TreeCtrl with an other wxIEHtmlWin it works
fine

<--code-->
from wxPython.wx import *
from wxPython.iewin import *

class MyFrame(wxFrame):
def __init__(self,parent,id,title):
  wxFrame.__init__(self,parent,id,title)

···

#---------------------------------------------------------------------------
------------------------
  # Create statusbar

#---------------------------------------------------------------------------
------------------------
  self.CreateStatusBar()
  self.SetStatusText("Iwatch")

#---------------------------------------------------------------------------
------------------------
  # Create splitter Window

#---------------------------------------------------------------------------
------------------------
  splitter = WxSplitterWindow(self,-1)

#---------------------------------------------------------------------------
------------------------
  # Create Tree

#---------------------------------------------------------------------------
------------------------
  self.tree = wxTreeCtrl(self,-1)
  self.root = self.tree.AddRoot("Iwatch")
  self.child = self.tree.AppendItem(self.root,"Site Watch")

#---------------------------------------------------------------------------
------------------------
  # Create browser

#---------------------------------------------------------------------------
------------------------
  self.browser = wxIEHtmlWin(self)
  self.browser.Navigate("http://www.google.be")

#---------------------------------------------------------------------------
------------------------
  # add 2 widget in splitter windows

#---------------------------------------------------------------------------
------------------------
  splitter.SplitVertically(self.tree,self.browser)
  self.Show(true)

class Myapp(wxApp):
def OnInit(self):
  frame = MyFrame(NULL,-1,"Iwatch")
  frame.Show(1)
  return true

app = Myapp()

Does the tree control work by itself?

"Divide and conquer"

···

-----Original Message-----
From: Jonas Geiregat [mailto:kemu@sdf-eu.org]
Sent: Friday, April 18, 2003 4:08 AM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] wxSplitter code fragment

I don't know what I'm doing wrong here,
I try to add a TreeCtrl and a wxIEHtmlWin in a splitterwindow
it won't work if I replace the TreeCtrl with an other wxIEHtmlWin it works
fine

<--code-->
from wxPython.wx import *
from wxPython.iewin import *

class MyFrame(wxFrame):
def __init__(self,parent,id,title):
  wxFrame.__init__(self,parent,id,title)

#-------------------------------------------------------------------------
--
------------------------
  # Create statusbar

#-------------------------------------------------------------------------
--
------------------------
  self.CreateStatusBar()
  self.SetStatusText("Iwatch")

#-------------------------------------------------------------------------
--
------------------------
  # Create splitter Window

#-------------------------------------------------------------------------
--
------------------------
  splitter = WxSplitterWindow(self,-1)

#-------------------------------------------------------------------------
--
------------------------
  # Create Tree

#-------------------------------------------------------------------------
--
------------------------
  self.tree = wxTreeCtrl(self,-1)
  self.root = self.tree.AddRoot("Iwatch")
  self.child = self.tree.AppendItem(self.root,"Site Watch")

#-------------------------------------------------------------------------
--
------------------------
  # Create browser

#-------------------------------------------------------------------------
--
------------------------
  self.browser = wxIEHtmlWin(self)
  self.browser.Navigate("http://www.google.be")

#-------------------------------------------------------------------------
--
------------------------
  # add 2 widget in splitter windows

#-------------------------------------------------------------------------
--
------------------------
  splitter.SplitVertically(self.tree,self.browser)
  self.Show(true)

class Myapp(wxApp):
def OnInit(self):
  frame = MyFrame(NULL,-1,"Iwatch")
  frame.Show(1)
  return true

app = Myapp()

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

it works fine if I place the tree on a frame
should a place it on a frame or something like that
if so what would be best suited ?

···

----- Original Message -----
From: "Ben Allfree" <benles@bldigital.com>
To: <wxPython-users@lists.wxwindows.org>
Sent: Friday, April 18, 2003 1:54 PM
Subject: RE: [wxPython-users] wxSplitter code fragment

Does the tree control work by itself?

"Divide and conquer"

> -----Original Message-----
> From: Jonas Geiregat [mailto:kemu@sdf-eu.org]
> Sent: Friday, April 18, 2003 4:08 AM
> To: wxPython-users@lists.wxwindows.org
> Subject: Re: [wxPython-users] wxSplitter code fragment
>
> I don't know what I'm doing wrong here,
> I try to add a TreeCtrl and a wxIEHtmlWin in a splitterwindow
> it won't work if I replace the TreeCtrl with an other wxIEHtmlWin it

works

> fine
>
> <--code-->
> from wxPython.wx import *
> from wxPython.iewin import *
>
> class MyFrame(wxFrame):
> def __init__(self,parent,id,title):
> wxFrame.__init__(self,parent,id,title)
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> # Create statusbar
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> self.CreateStatusBar()
> self.SetStatusText("Iwatch")
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> # Create splitter Window
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> splitter = WxSplitterWindow(self,-1)
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> # Create Tree
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> self.tree = wxTreeCtrl(self,-1)
> self.root = self.tree.AddRoot("Iwatch")
> self.child = self.tree.AppendItem(self.root,"Site Watch")
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> # Create browser
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> self.browser = wxIEHtmlWin(self)
> self.browser.Navigate("http://www.google.be")
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> # add 2 widget in splitter windows
>
>

#-------------------------------------------------------------------------

> --
> ------------------------
> splitter.SplitVertically(self.tree,self.browser)
> self.Show(true)
>
>
> class Myapp(wxApp):
> def OnInit(self):
> frame = MyFrame(NULL,-1,"Iwatch")
> frame.Show(1)
> return true
>
> app = Myapp()
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Send code attachment to my e-mail, let me look.

···

-----Original Message-----
From: Jonas Geiregat [mailto:kemu@sdf-eu.org]
Sent: Friday, April 18, 2003 5:16 AM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] wxSplitter code fragment

it works fine if I place the tree on a frame
should a place it on a frame or something like that
if so what would be best suited ?

----- Original Message -----
From: "Ben Allfree" <benles@bldigital.com>
To: <wxPython-users@lists.wxwindows.org>
Sent: Friday, April 18, 2003 1:54 PM
Subject: RE: [wxPython-users] wxSplitter code fragment

> Does the tree control work by itself?
>
> "Divide and conquer"
>
> > -----Original Message-----
> > From: Jonas Geiregat [mailto:kemu@sdf-eu.org]
> > Sent: Friday, April 18, 2003 4:08 AM
> > To: wxPython-users@lists.wxwindows.org
> > Subject: Re: [wxPython-users] wxSplitter code fragment
> >
> > I don't know what I'm doing wrong here,
> > I try to add a TreeCtrl and a wxIEHtmlWin in a splitterwindow
> > it won't work if I replace the TreeCtrl with an other wxIEHtmlWin it
works
> > fine
> >
> > <--code-->
> > from wxPython.wx import *
> > from wxPython.iewin import *
> >
> > class MyFrame(wxFrame):
> > def __init__(self,parent,id,title):
> > wxFrame.__init__(self,parent,id,title)
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > # Create statusbar
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > self.CreateStatusBar()
> > self.SetStatusText("Iwatch")
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > # Create splitter Window
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > splitter = WxSplitterWindow(self,-1)
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > # Create Tree
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > self.tree = wxTreeCtrl(self,-1)
> > self.root = self.tree.AddRoot("Iwatch")
> > self.child = self.tree.AppendItem(self.root,"Site Watch")
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > # Create browser
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > self.browser = wxIEHtmlWin(self)
> > self.browser.Navigate("http://www.google.be")
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > # add 2 widget in splitter windows
> >
> >
#-------------------------------------------------------------------------
> > --
> > ------------------------
> > splitter.SplitVertically(self.tree,self.browser)
> > self.Show(true)
> >
> >
> > class Myapp(wxApp):
> > def OnInit(self):
> > frame = MyFrame(NULL,-1,"Iwatch")
> > frame.Show(1)
> > return true
> >
> > app = Myapp()
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
> > For additional commands, e-mail: wxPython-users-
help@lists.wxwindows.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org