473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

wxPython Grid XY Coordinates question

Hello All,
I am writing an app in wxPython using a grid. I need to be able to
recognize what cell in the grid the user is hovering over with the
mouse. How to do this?
I tried XYToCell(x, y), but that doesnt work properly because it
thinks that mouse position (0, 0) is the first cell in the grid, and
then goes from there, so if i move the grid to a differernt area on the
screen, the XYToCell is messed up in what it returns.

Any ideas on how to get this to work or any other way?

thanks,
Kiran

Jul 14 '06 #1
2 2977
Kiran wrote:
Hello All,
I am writing an app in wxPython using a grid. I need to be able to
recognize what cell in the grid the user is hovering over with the
mouse. How to do this?
I tried XYToCell(x, y), but that doesnt work properly because it
thinks that mouse position (0, 0) is the first cell in the grid, and
then goes from there, so if i move the grid to a differernt area on the
screen, the XYToCell is messed up in what it returns.

Any ideas on how to get this to work or any other way?
XYToCell probably takes window (client) coordinates. If you have the
mouse position in screen coordinates, you will need to convert them with
the ScreenToClient for your grid.

Will McGugan
--
work: http://www.kelpiesoft.com
blog: http://www.willmcgugan.com
Jul 14 '06 #2
Will, thank you.
That was the right thing to do, and it worked

-- Kiran

Will McGugan wrote:
Kiran wrote:
Hello All,
I am writing an app in wxPython using a grid. I need to be able to
recognize what cell in the grid the user is hovering over with the
mouse. How to do this?
I tried XYToCell(x, y), but that doesnt work properly because it
thinks that mouse position (0, 0) is the first cell in the grid, and
then goes from there, so if i move the grid to a differernt area on the
screen, the XYToCell is messed up in what it returns.

Any ideas on how to get this to work or any other way?

XYToCell probably takes window (client) coordinates. If you have the
mouse position in screen coordinates, you will need to convert them with
the ScreenToClient for your grid.

Will McGugan
--
work: http://www.kelpiesoft.com
blog: http://www.willmcgugan.com
Jul 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: flupke | last post by:
Hi, i'm trying to convert my java console app to a python gui. Now, the only problem i seem to have at the moment are the resizers for the layout. It seems that for the purpose of what i'm...
4
by: Piet | last post by:
Hello. I am working on an XML editor that will not display the xml file as plain text, but will rather work with a combination of a tree view for the main element nodes and some kind of tabular...
1
by: dberlin | last post by:
Hi, I'm building a modest GUI editor for myself using wxPython, and I need some help. I want to create a nice 'Control Property Editing Window', just like VisualBasic, Delphi, Visual C++, etc....
6
by: rbann11 | last post by:
Hi, I am looking for example code that consists of just a frame and a grid(10x2). The grid must fill the its parent even if the frame is resized. Thanks in advance, Roger
1
by: Kiran | last post by:
Hello All, I created a grid, where I register events every time the user changes an existing value inside the grid control. Right now, I am using the event: EVT_GRID_CELL_CHANGE. However, I...
3
by: Jordan | last post by:
Hey Peoples, I'm wonderg if there is a way to make a subclass of wx.grid.Grid in which the coloumn labels for the grid appear on the bottom of the grid instead of the top. 1 2 3 4 5 a| | ...
9
by: Tyler | last post by:
Hello All: I am currently working on a project to create an FEM model for school. I was thinking about using wxPython to gather the 12 input variables from the user, then, after pressing the...
2
by: OpenPavilion | last post by:
Hello, did anyone succeed in combining wxpython and a 3d engine (pyogre, crystalblend, panda3d, soya etc.) ? I would like to create an application, which uses wxpython tree, menu and grid...
17
by: NoelByron | last post by:
Hello! We are thinking about writing a project for several customers in Python. This project would include (among others) wxPython, a C/C++ module. But what happens if this application generates...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.