I developed a wxpython app using 2.8.7.1 on Linux, and it works just fine.
(I have adapted the DragImage demo, and removed a lot of code.)
When I ran it on Windows with wxpython 2.8.8.0, it doesn't have any
background, instead it draws on the graphics that were behind the
current window.
I also get the following errors:
File "C:\Documents and Settings\Tiana\Desktop\wxpython\DragImage.py", line 219
, in OnEraseBackground
self.TileBackground(dc)
AttributeError: 'DragCanvas' object has no attribute 'TileBackground'
Traceback (most recent call last):
File "C:\Documents and Settings\Tiana\Desktop\wxpython\DragImage.py", line 219
, in OnEraseBackground
self.TileBackground(dc)
AttributeError: 'DragCanvas' object has no attribute 'TileBackground'
Any idea what the problem is?
Thanks,
Joseph
Joseph Turian wrote:
The following is the code I'm using. I have removed use of the
background image, but apparently have not modified it correctly.
I would like a plain white background:
I suspect this is your issue:
# Clears the background, then redraws it. If the DC is passed, then
# we only do so in the area so designated. Otherwise, it's the whole thing.
def OnEraseBackground(self, evt):
dc = evt.GetDC()
if not dc:
dc = wx.ClientDC(self)
rect = self.GetUpdateRegion().GetBox()
dc.SetClippingRect(rect)
self.TileBackground(dc)
This function gets called when the background needs erasing -- it's calling TileBackground(), but if you're not using that, it should call something like:
dc.SetBackground(wx.WHITE_BRUSH)
dc.Clear()
Hope that helps,
-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
Great, thanks Christopher.
Strangely, now Windows has a white background, whereas Linux still has
a gray background.
Why is that?
···
On Tue, Jul 8, 2008 at 2:28 AM, Christopher Barker <Chris.Barker@noaa.gov> wrote:
Joseph Turian wrote:
The following is the code I'm using. I have removed use of the
background image, but apparently have not modified it correctly.
I would like a plain white background:
I suspect this is your issue:
# Clears the background, then redraws it. If the DC is passed, then
# we only do so in the area so designated. Otherwise, it's the whole
thing.
def OnEraseBackground(self, evt):
dc = evt.GetDC()
if not dc:
dc = wx.ClientDC(self)
rect = self.GetUpdateRegion().GetBox()
dc.SetClippingRect(rect)
self.TileBackground(dc)
This function gets called when the background needs erasing -- it's calling
TileBackground(), but if you're not using that, it should call something
like:
dc.SetBackground(wx.WHITE_BRUSH)
dc.Clear()
Hope that helps,
-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
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
--
Academic: http://www-etud.iro.umontreal.ca/~turian/
Business: http://www.metaoptimize.com/
Joseph Turian wrote:
Great, thanks Christopher.
Strangely, now Windows has a white background, whereas Linux still has
a gray background.
Why is that?
hmm. I don't know. Why don't you make a small as you can runnable sample and post that -- I'll bet someone can figure it out.
http://wiki.wxpython.org/MakingSampleApps
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (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