Connecting Tech Pros Worldwide Forums | Help | Site Map

wxGrid

Subsciber123's Avatar
Member
 
Join Date: Nov 2006
Location: Eastern Time Zone
Posts: 87
#1: Jun 30 '09
Hi,
I'm using Python 2.6, and I'm trying to write a gui program that uses wxGrid. I have made it so that the columns can be dragged around to different locations, but I need to bind to an event that tells me when they are moved, and which one moved where. Can anybody help me with this? I don't see any events that jump out at me as being relevant.

Thanks.

Subsciber123's Avatar
Member
 
Join Date: Nov 2006
Location: Eastern Time Zone
Posts: 87
#2: Jun 30 '09

re: wxGrid


This problem turns out to be even more annoying than I thought.

I just realized that when you drag a column to a different position (say column zero) it retains the same column number (i.e. zero).

I guess that the question now is, if you have a column, how do you tell whether it is to the right or the left of another column within wxGrid?

An event to tell me when someone drags a label around would still be nice.
Subsciber123's Avatar
Member
 
Join Date: Nov 2006
Location: Eastern Time Zone
Posts: 87
#3: Jun 30 '09

re: wxGrid


Ah. It's wxGrid.GetColPos()

Okay, what about that event? I need to know when the column position changes.

Thanks in advance.
Subsciber123's Avatar
Member
 
Join Date: Nov 2006
Location: Eastern Time Zone
Posts: 87
#4: Jul 1 '09

re: wxGrid


So far, I've used a dirty hack. I've created a timer with events, and as soon as someone clicks on the title, it starts the timer. When someone drops the title, the next timer event stops the timer and I can make the program do what I want it to do. So much for good form. At least I'm not using threads.

Please post if you have a better way of doing it.
Reply

Tags
columns, sorting, wxgrid, wxpython