mapq = PhotoImage(file = 'C:\Users\safta rn\Desktop\elma povic.gif')
w.create_image( 10, 10, image = mapq, anchor = NW)
after doing this is there any possibility of getting the
characteristics of the GIF-picture(or bitmap if i use that)?
it would be very helpfull if i for example could do something like
canvas.getcolor (image, mouseclick.x,mo useclick.y) if u get the point.
get the color of the image where i clicked. 4 9123 sk*******@yahoo .se wrote:
mapq = PhotoImage(file = 'C:\Users\safta rn\Desktop\elma povic.gif')
w.create_image( 10, 10, image = mapq, anchor = NW)
after doing this is there any possibility of getting the
characteristics of the GIF-picture(or bitmap if i use that)?
it would be very helpfull if i for example could do something like
canvas.getcolor (image, mouseclick.x,mo useclick.y) if u get the point.
get the color of the image where i clicked.
The image isn't "painted" on the canvas, so to answer your specific
question, no, you can't get the color of a pixel on the canvas in the
way that you ask.
However, when you click on the canvas you can get the item that was
clicked on and the x/y of the click. From that you can figure out which
pixel of the image is under the cursor. And from that you can query the
image for the color of a specific pixel.
On 13 Apr, 19:19, Bryan Oakley <oak...@bardo.c learlight.comwr ote:
skanem...@yahoo .se wrote:
mapq = PhotoImage(file = 'C:\Users\safta rn\Desktop\elma povic.gif')
w.create_image( 10, 10, image = mapq, anchor = NW)
after doing this is there any possibility of getting the
characteristics of the GIF-picture(or bitmap if i use that)?
it would be very helpfull if i for example could do something like
canvas.getcolor (image, mouseclick.x,mo useclick.y) if u get the point.
get the color of the image where i clicked.
The image isn't "painted" on the canvas, so to answer your specific
question, no, you can't get the color of a pixel on the canvas in the
way that you ask.
However, when you click on the canvas you can get the item that was
clicked on and the x/y of the click. From that you can figure out which
pixel of the image is under the cursor. And from that you can query the
image for the color of a specific pixel.
how do i get the item? http://effbot.org/tkinterbook/canvas...e_image-method
with any of those methods?
when i click the mouse i can get event.object u mean? sk*******@yahoo .se wrote:
On 13 Apr, 19:19, Bryan Oakley <oak...@bardo.c learlight.comwr ote:
>skanem...@yaho o.se wrote:
>>mapq = PhotoImage(file = 'C:\Users\safta rn\Desktop\elma povic.gif') w.create_imag e(10, 10, image = mapq, anchor = NW) after doing this is there any possibility of getting the characteristi cs of the GIF-picture(or bitmap if i use that)? it would be very helpfull if i for example could do something like canvas.getcol or(image, mouseclick.x,mo useclick.y) if u get the point. get the color of the image where i clicked.
The image isn't "painted" on the canvas, so to answer your specific question, no, you can't get the color of a pixel on the canvas in the way that you ask.
However, when you click on the canvas you can get the item that was clicked on and the x/y of the click. From that you can figure out which pixel of the image is under the cursor. And from that you can query the image for the color of a specific pixel.
how do i get the item? http://effbot.org/tkinterbook/canvas...e_image-method
with any of those methods?
when i click the mouse i can get event.object u mean?
You can use find_closest to find the object closest to the x,y of the
event. You can also do find_withtag(tk .CURRENT) which returns the item
under the mouse pointer.
On 16 Apr, 00:46, Bryan Oakley <oak...@bardo.c learlight.comwr ote:
skanem...@yahoo .se wrote:
On 13 Apr, 19:19, Bryan Oakley <oak...@bardo.c learlight.comwr ote:
skanem...@yahoo .se wrote: mapq = PhotoImage(file = 'C:\Users\safta rn\Desktop\elma povic.gif') w.create_image (10, 10, image = mapq, anchor = NW) after doing this is there any possibility of getting the characteristic s of the GIF-picture(or bitmap if i use that)? it would be very helpfull if i for example could do something like canvas.getcolo r(image, mouseclick.x,mo useclick.y) if u get the point. get the color of the image where i clicked.
The image isn't "painted" on the canvas, so to answer your specific
question, no, you can't get the color of a pixel on the canvas in the
way that you ask.
However, when you click on the canvas you can get the item that was
clicked on and the x/y of the click. From that you can figure out which
pixel of the image is under the cursor. And from that you can query the
image for the color of a specific pixel.
how do i get the item? http://effbot.org/tkinterbook/canvas....create_image-...
with any of those methods?
when i click the mouse i can get event.object u mean?
You can use find_closest to find the object closest to the x,y of the
event. You can also do find_withtag(tk .CURRENT) which returns the item
under the mouse pointer.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python25\li b\lib-tk\Tkinter.py", line 1403, in __call__
return self.func(*args )
File "C:\Users\safta rn\Desktop\pyth onkod\mapexperi ments
\mapgetobject.p y", line 17, in callback
undermouse=find _closest(master .CURRENT)
NameError: global name 'find_closest' is not defined
from Tkinter import *
master = Tk()
w = Canvas(master, width=400, height=625)
w.pack(expand = YES, fill = BOTH)
mapq = PhotoImage(file = 'C:\Users\safta rn\Desktop\imag es
\something.gif' )
w.create_image( 30, 30, image = mapq, anchor = NW)
def key(event):
print "pressed", repr(event.char )
def callback(event) :
clobj=event.wid get
## undermouse=find _withtag(master .CURRENT)
undermouse=find _closest(master .CURRENT)
print repr(undermouse )
w.bind("<Key>", key)
w.bind("<Button-1>", callback)
w.pack()
mainloop() This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michael Zhang |
last post by:
My project uses Python-2.3.4 + Tkinter + PIL-1.1.4 to retrieve images
from server and display those images.
I created a thread (also a separate toplevel window) for displaying
images and another thread for recording the frame rates (using a
progress bar for visulization). The whole application worked very well
once it received image data...
|
by: Tuvas |
last post by:
I've been trying to use a canvas to display different pictures on a
Tkinter interface. However, it doesn't seem to update the information.
Ei, I have something like this.
canvas=Canvas(master,blah...)
canvas.pack()
def change_pic(path):
global pic
image=Image() #I'm using PIL to use the images, but I
|
by: annagel |
last post by:
I am looking for a way to force a Tkinter window into focus on a system
level. I know the force focus method should bring one window of my
application into focus, but it seems I need to have some part of my
application already in focus on a system level to make this work. If
for example I am entering text at the command line and call a...
|
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 # args: should be ".-1211472948 .-1211470996 addtag tag
searchCommand ?arg arg ...?
My code works like this:
if (pic):
|
by: john.orlando |
last post by:
Hello,
I'm a newbie to Python (literally, within the last two weeks), and I am
playing around with Tkinter to build some simple GUIs. I am attempting
to build a simple class that displays a GIF. Here is the code:
#start of code
from Tkinter import *
class DisplayPict(Frame):
| |
by: apriebe47 |
last post by:
Hello,
I have created a simple canvas in Tkinter to display a number of
PhotoImages, I then bind a key (in my case, <Up>) to start a loop that
plays through a list of PhotoImages to make it an animation of sorts.
What I noticed is, after holding down the key for a certain time, it
would not loop through all 6 animations, instead it would...
|
by: sj |
last post by:
I am just learning to use Tkinter and am having problems displaying image
files. I am able to display an image using tutorials (such as
http://www.daniweb.com/code/snippet296.html) But when I try my own code all
I get is an empty widget. What is wrong with the following program?
from Tkinter import *
|
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 find_withtag or find_closest but
it is not working, maybe im using the
method on the wrong object.
how do i do this?
and how do i then get specifics about...
|
by: Peter Pearson |
last post by:
Tkinter makes it very easy to drag jpeg images around on a
canvas, but I would like to have a "target" change color when
the cursor dragging an image passes over it. I seem to be
blocked by the fact that the callbacks that might tell the
target that the mouse has entered it (<Enter>, <Any-Enter>,
even <Motion>) aren't called if the mouse's...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| | |