473,382 Members | 1,359 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,382 software developers and data experts.

Canvas clicking stuff

I have a picture that is being displayed on a canvas interface, that I
want to do the following. When a mouse button is clicked on the canvas,
I want to pass to a function the X and Y coordinates of where this
mouse button was pushed. Futhermore, and I don't know if this is
possible, I would like to have a function that passes the same data
without a mouse button being clicked, or perhaps differentiating
between left and right clicks. Thanks for the help!

Feb 20 '06 #1
4 1319
I guess I should have mentioned that the canvas is a Tkinter canvas,
but, well, I guess that could be infered.

Feb 20 '06 #2
Tuvas enlightened us with:
I have a picture that is being displayed on a canvas interface, that
I want to do the following. [...]


There are loads of GUI toolkits you could be using.

Please read "How To Ask Questions The Smart Way":
http://catb.org/~esr/faqs/smart-questions.html

It's a very good read for anyone, and especially for you.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Feb 20 '06 #3
Tuvas wrote:
I have a picture that is being displayed on a canvas interface, that I
want to do the following. When a mouse button is clicked on the canvas,
I want to pass to a function the X and Y coordinates of where this
mouse button was pushed.


use event bindings:

http://effbot.org/tkinterbook/tkinte...d-bindings.htm

</F>

Feb 20 '06 #4
Ahh, exactly what I was looking for. Thanks for the help!
Fredrik Lundh wrote:
Tuvas wrote:
I have a picture that is being displayed on a canvas interface, that I
want to do the following. When a mouse button is clicked on the canvas,
I want to pass to a function the X and Y coordinates of where this
mouse button was pushed.


use event bindings:

http://effbot.org/tkinterbook/tkinte...d-bindings.htm

</F>


Feb 20 '06 #5

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

Similar topics

0
by: Mickel Grönroos | last post by:
Hi, I'm trying to put an Tkinter.Entry of fixed size onto a specific location on a canvas using the place manager. The idea is that one can double-click a rectangle object on a canvas to get an...
3
by: Tuvas | last post by:
I'm trying to display a picture on a Tkinter Canvas. It seems to work fine the first time that it is displayed. However, subsequent times running shows an error like this: TCLerror: Wrong #...
1
by: Bob Greschke | last post by:
I have a program that sucks in a list of equipment positions (Lats/Longs), opens a Toplevel frame with a canvas set to, for example, 700x480 pixels, and then does all of the calculations and plots...
1
by: Andrew Poulos | last post by:
I'm using canvas to draw shapes on screen (to highlight items of interest). All's working fine until a circle is drawn around a button the user needs to click. The canvas "covers" the button so...
16
by: eben | last post by:
I've been playing with the canvas primitive available in some of the modern browsers, and have put together a little 3d engine that I thought other people might find useful. See ...
26
by: Jon Davis | last post by:
OK, why is Canvas not IDisposable, and how do I get rid of all the Windows handles? I'm doing a performance test of looping through a dynamic XAML-to-JPEG conversion. It gets to about 500...
6
by: Nebulism | last post by:
I have been attempting to utilize a draw command script that loads a canvas, and through certain mouse events, draws rectangles. The original code is from...
1
by: nish88 | last post by:
Hi!! Actually,i am doing a simulation and i want a dot (small oval) to pop up when i click(by mouse) on the canvas. can anyone please help me or if possible give me the piece of codes to perform...
3
by: skanemupp | last post by:
so i load a gif onto a canvas and when i click the canvs i want to get the color of the pixel that is clicked. so i need to ge the object im clicking. i was told in another thread to use...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.