Scrolling window not causing a redraw (wxPython 2.4.2.4)

I have written a program that uses a wxScrolledWindow, with a "world"
that can not
fit entirely in the window.

If I scroll the window as the first action, the screen doesn't get redrawn,
but rather is erased as it moves out of view and back. As soon as I resize
the window, everything is fine: I can scroll the window and the view
moves as one would expect. Here's a snapshot of what I do:

class WorldGUI(wxScrolledWindow):
    def __init__(self, parent, id = -1, size = wxDefaultSize):
        wxScrolledWindow.__init__(self, parent, id, (0, 0), size=size,
                                  style=wxSUNKEN_BORDER)
[snip]

    def SetEvents(self):
        EVT_PAINT(self, self.OnPaint) # wxPython 2.4
        # the window resize event and idle events for managing the buffer
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_IDLE(self, self.OnIdle)
        wx.EVT_SCROLL(self, self.OnScroll)

    def OnSize(self, event=None):
        self.reInitBuffer = True

    def OnScroll(self, event=None):
        self.reInitBuffer = True
        # Note: it doesn't force a redraw the same way OnSize do!!!

    def OnIdle(self, event=None):
        if self.reInitBuffer:
            self.InitBuffer()
            self.Refresh(False)
            self.reInitBuffer = False

    def InitBuffer(self):
        if USE_BUFFERED_DC: # For Windows XP
            # Initialize the buffer bitmap.
            self.buffer = wxEmptyBitmap(self.maxWidth, self.maxHeight)
            dc = wxBufferedDC(None, self.buffer)
            dc.SetBackground(wxBrush(self.GetBackgroundColour()))
            dc.Clear()
            self.DoDrawing(dc)
        else:

[snip]

Any hint would be appreciated!

André

Hi,
wxPython 2.3.5.1 appearantly doesn't load the the path
where the wx module is (eg
C:\Python23\Lib\site-packages\wx-2.5.3-msw-ansi) in
the sys.path list. This is ok for normal python use
as magically "import wx" imports the module.
The problem is when I start SPE (http://spe.pycs.net)
in Blender that an "import wx" statement doesn't work
(module not found). A solution is to add manually the
path to sys.path but of course this can't be asked
from end-users of SPE.
Therefore I have the kind request if something can be
done about this automatically already within the
future wxPython distributions?
Thanks,
Stani

http://spe.pycs.net
http://www.stani.be

···

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

look at the code of wxversion.py there is some text in there about possible problems... it might not help but then again... maybe it will.
Also... take a look at:
http://wiki.wxpython.org/index.cgi/MultiVersionInstalls

···

On Thu, 11 Nov 2004 07:35:53 -0800 (PST), www.stani.be <s_t_a_n_i@yahoo.com> wrote:

Hi,
wxPython 2.3.5.1 appearantly doesn't load the the path
where the wx module is (eg
C:\Python23\Lib\site-packages\wx-2.5.3-msw-ansi) in
the sys.path list. This is ok for normal python use
as magically "import wx" imports the module.
The problem is when I start SPE (http://spe.pycs.net)
in Blender that an "import wx" statement doesn't work
(module not found). A solution is to add manually the
path to sys.path but of course this can't be asked
from end-users of SPE.
Therefore I have the kind request if something can be
done about this automatically already within the
future wxPython distributions?
Thanks,
Stani

--
Peter Damoc
Hacker Wannabe

Andre Roberge wrote:

I have written a program that uses a wxScrolledWindow, with a "world"
that can not
fit entirely in the window.

If I scroll the window as the first action, the screen doesn't get redrawn,
but rather is erased as it moves out of view and back. As soon as I resize
the window, everything is fine: I can scroll the window and the view
moves as one would expect. Here's a snapshot of what I do:

Do you call self.PrepareDC(dc) anywhere? If that's not the problem then please duplicate the issue in a small but complete application so that others can fully help you.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

www.stani.be wrote:

Hi,
wxPython 2.3.5.1 appearantly doesn't load the the path
where the wx module is (eg
C:\Python23\Lib\site-packages\wx-2.5.3-msw-ansi) in
the sys.path list. This is ok for normal python use
as magically "import wx" imports the module.

There is no magic about it. The wx.pth file causes the dir to be appended to the sys.path. (Unless you told the installer to not install wx.pth by clearing the "make this version the default" checkbox.) For example, *without* the wx.pth file:

C:\> python -c "import sys,pprint; pprint.pprint(sys.path)"
['C:\\',
  'C:\\WINDOWS\\system32\\python23.zip',
  'C:\\TOOLS\\Python23\\lib\\site-packages\\Pythonwin',
  'C:\\TOOLS\\Python23\\lib\\site-packages\\win32',
  'C:\\TOOLS\\Python23\\lib\\site-packages\\win32\\lib',
  'C:\\TOOLS\\Python23\\lib\\site-packages',
  'c:\\TOOLS\\Python23\\DLLs',
  'c:\\TOOLS\\Python23\\lib',
  'c:\\TOOLS\\Python23\\lib\\plat-win',
  'c:\\TOOLS\\Python23\\lib\\lib-tk',
  'c:\\TOOLS\\Python23',
  'c:\\TOOLS\\Python23\\lib\\site-packages\\Numeric',
  'c:\\TOOLS\\Python23\\lib\\site-packages\\PIL']

And *with* the wx.pth file:

C:\> python -c "import sys,pprint; pprint.pprint(sys.path)"
['C:\\',
  'C:\\WINDOWS\\system32\\python23.zip',
  'C:\\TOOLS\\Python23\\lib\\site-packages\\Pythonwin',
  'C:\\TOOLS\\Python23\\lib\\site-packages\\win32',
  'C:\\TOOLS\\Python23\\lib\\site-packages\\win32\\lib',
  'C:\\TOOLS\\Python23\\lib\\site-packages',
  'c:\\TOOLS\\Python23\\DLLs',
  'c:\\TOOLS\\Python23\\lib',
  'c:\\TOOLS\\Python23\\lib\\plat-win',
  'c:\\TOOLS\\Python23\\lib\\lib-tk',
  'c:\\TOOLS\\Python23',
  'c:\\TOOLS\\Python23\\lib\\site-packages\\Numeric',
  'c:\\TOOLS\\Python23\\lib\\site-packages\\PIL',
  'c:\\TOOLS\\Python23\\lib\\site-packages\\wx-2.5.3-msw-ansi']

The problem is when I start SPE (http://spe.pycs.net)
in Blender that an "import wx" statement doesn't work
(module not found). A solution is to add manually the
path to sys.path but of course this can't be asked
from end-users of SPE.

I know nothing about Blender so forgive me if these are stupid questions: when you say start SPE in Blender is it using the standard Python installed on your system or does it have it's own embedded version? Does it do anything special when it runs Python that could affect the sys.path? Is SPE able to import wx when it is started outside of Blender?

Therefore I have the kind request if something can be
done about this automatically already within the
future wxPython distributions?

There should be nothing that needs to be done, but as Peter mentioned you can use wxversion to request that a particular version be inserted at the begining of the sys.path (if it is found.)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

You are right. The problem is in Blender. I'll ask the
coders to fix it there.

Thanks,
Stani

···

--- Robin Dunn <robin@alldunn.com> wrote:

www.stani.be wrote:
> Hi,
> wxPython 2.3.5.1 appearantly doesn't load the the
path
> where the wx module is (eg
> C:\Python23\Lib\site-packages\wx-2.5.3-msw-ansi)
in
> the sys.path list. This is ok for normal python
use
> as magically "import wx" imports the module.

There is no magic about it. The wx.pth file causes
the dir to be
appended to the sys.path. (Unless you told the
installer to not install
wx.pth by clearing the "make this version the
default" checkbox.) ...

__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com

www.stani.be wrote:

You are right.

My favorite three words! Well, one set of my favorite three words anyway... :wink:

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

What about this?
You are always right

I guess that is your favorite set of four words :wink:

Stani

···

--- Robin Dunn <robin@alldunn.com> wrote:

www.stani.be wrote:

> You are right.

My favorite three words! Well, one set of my
favorite three words
anyway... :wink:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax
with wxPython!

---------------------------------------------------------------------

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

__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com