wxGrid
Paul McNett
p at ulmcnett.com
Mon Feb 28 11:00:16 EST 2005
Gensek wrote:
> I have a grid. I want to sort it when a column label is clicked. I know
> about the EVT_GRID_LABEL_LEFT_DCLICK event, but that is not enough. I
> do not merely need to know that a label was clicked. I need to know
> which label was clicked. I do not know how to do that. I suspect you
> might know. I request that you tell me.
Please see:
http://wiki.wxpython.org/index.cgi/DrawingOnGridColumnLabel
It tells you how to draw a sort indicator on the clicked header, which
involves first figuring out which header was clicked. As you've found,
the entire header region is one wxWindow, not one per column, which does
make it a bit more difficult to sort out which column header was
clicked. This sample does not go on to show you how to actually do the
sorting, however.
> I also wish to know some other things: how to find out the location of
> a mouse pointer in a wxWindow (or at least the frame),
Bind a function to the wx.EVT_MOTION event, and then call GetPosition()
of the event instance, which returns a (x,y) tuple of the mouse position
at the time the event was generated. x and y are relative to the window
that emitted the event.
> and how to
> change the color of a single specified pixel in a bitmap.
I don't know how to do this, but I'd take a look at the docs for
wxBitmap for starters.
> I use Python 2.3, wxPython 2.4.2.
You should upgrade to wxPython 2.5.3 (2.5.4 is around the corner
though). If you have a bunch of code already written for 2.4, you'll
want to upgrade carefully and refer to the migration guide at
http://wxpython.org first. Otherwise, if you are just starting with
wxPython, trust me you definitely want to upgrade ASAP - a lot of bugs
have been fixed and new features added since 2.4.2, and wxPython experts
will be better able to help you if you use a recent version...
Also, you may find more and better help by joining the wxpython-users
list - you can find a link at http://wxpython.org.
--
pkm ~ http://paulmcnett.com
More information about the Python-list
mailing list