I've made a first wxPy GUI using wxGlade. The interface uses two ListCtrl's and I want to modify the colors and fonts of items based on what's going on. The problem is that the items don't always get drawn properly (in fact, they don't get drawn at all at times) on my wxPython 2.4.0.7/Python 2.2.2 on Mandrake 9.1, but it works perfectly in WinXP (same wx/Py versions). For an idea of what's wrong, you can have a look at the following two screenshots: http://project5.freezope.org/pears/img/pears07mandrake91error.png http://project5.freezope.org/pears/img/pears07mandrake91.png
The one with the error doesn't show all items (that's why there are such huge gaps in the two listboxes), though even the "invisible" items are clickable, at which point they become visible.
This is the code I use for drawing each item:
def drawItem(self, list, itemnumber,
setToUnread=True,
setToCacheExceeded=False,
setToUpdating=False):
"""Draws an item."""
currentitem = list.GetItem(itemnumber)
currentfont = currentitem.GetFont()
if PLAINDRAWING: #do not use colors and stuff
def addOrRemoveMarker(marker, doadd):
"""Adds or removes a marker from an item."""
txt = currentitem.GetText()
if doadd:
if txt.find(marker)<0:
currentitem.SetText(marker+txt)
else:
if txt.find(marker)==0:
currentitem.SetText(txt[len(marker):])
addOrRemoveMarker("* ", setToUnread)
else: #advanced drawing, this is the source of the problems
if setToUnread:
weight = wxBOLD
else:
weight = wxNORMAL
currentfont.SetWeight(weight)
currentfont.SetUnderlined(setToUpdating)
currentitem.SetFont(currentfont)
if setToCacheExceeded:
currentitem.SetTextColour(wxNamedColour("forest green"))
else:
currentitem.SetTextColour(wxNamedColour("black")) #currentfont.SetStyle(style)
list.SetItem(currentitem)
That PLAINDRAWING thing is a workaround for the problem mentioned above, so it really wasn't supposed to be there. Any idea on what I'm doing wrong?
Yours,
Andrei
···
=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5@bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gur yvfg, fb gurer'f ab arrq gb PP.
_____________________________________________________________
Get email for your site ---> http://www.everyone.net
I've made a first wxPy GUI using wxGlade. The interface uses two ListCtrl's and I want to modify the colors and fonts of items based on what's going on. The problem is that the items don't always get drawn properly (in fact, they don't get drawn at all at times) on my wxPython 2.4.0.7/Python 2.2.2 on Mandrake 9.1, but it works perfectly in WinXP (same wx/Py versions). For an idea of what's wrong, you can have a look at the following two screenshots:
Instead of modifying the attributes of the current font, (which is known to have a few problems in wxGTK) try creating a new font with all the attributes that you want.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I've made a first wxPy GUI using wxGlade. The interface uses two ListCtrl's and I want to modify the colors and fonts of items based on what's going on. The problem is that the items don't always get drawn properly (in fact, they don't get drawn at all at times) on my wxPython 2.4.0.7/Python 2.2.2 on Mandrake 9.1, but it works perfectly in WinXP (same wx/Py versions). For an idea of what's wrong, you can have a look at the following two screenshots:
[...]
Instead of modifying the attributes of the current font, (which is known to have a few problems in wxGTK) try creating a new font with all the attributes that you want.
I think that worked nicely, thanks. One other question though: I tried to get the font size from currentfont with GetPointSize() and got a huge traceback instead:
···
====
currentitem = list.GetItem(itemnumber)
currentfont = currentitem.GetFont()
a = currentfont.GetPointSize()
Traceback (most recent call last):
<snip>
File "pears.py", line 373, in drawItem
a = currentfont.GetPointSize()
File "C:\Programming\ActivePython\Lib\site-packages\wxPython\fonts.py", line 138, in GetPointSize
val = apply(fontsc.wxFont_GetPointSize,(self,) + _args, _kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in e:\projects\wx\src\msw\font.cpp(859): invalid font
03:33:49: Debug: e:\projects\wx\src\msw\app.cpp(439): 'UnregisterClass(canvas)' failed with error 0x00000584 (de klasse heeft nog geopende vensters.).
03:33:49: Debug: e:\projects\wx\src\msw\app.cpp(446): 'UnregisterClass(no redraw canvas)' failed with error 0x00000584 (de klasse heeft nog geopende vensters.).
The same code works nicely when currentfont=self.GetFont() [IOW, the font of the window rather than that of the listitem]. Is there any particular reason for this?
Andrei
=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5@bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gur yvfg, fb gurer'f ab arrq gb PP.
AFAIK no.
grep wxTabCtrl in wxPython gives no result = not supported.
The notebook widget is supported.
···
On Monday 09 June 2003 08:56 pm, Ivar N. Marohombsar wrote:
Hello !
Is wxTabCtrl supported in wxPython ?
yours truly,
Ivar
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
--
UC
--
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417
I think that worked nicely, thanks. One other question though: I tried to get the font size from currentfont with GetPointSize() and got a huge traceback instead:
Probably the font object wasn't valid at that point. What does currentfont.Ok() return?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I think that worked nicely, thanks. One other question though: I tried to get the font size from currentfont with GetPointSize() and got a huge traceback instead:
Probably the font object wasn't valid at that point. What does currentfont.Ok() return?