when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)
def hmm(event):
return event.widget 4 3997
En Tue, 15 Apr 2008 17:45:08 -0300, <sk*******@yaho o.seescribió:
when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)
def hmm(event):
return event.widget
Why don't you try by yourself? You can use: print repr(something)
--
Gabriel Genellina
On 16 Apr, 00:24, "Gabriel Genellina" <gagsl-...@yahoo.com.a rwrote:
En Tue, 15 Apr 2008 17:45:08 -0300, <skanem...@yaho o.seescribió:
when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)
def hmm(event):
return event.widget
Why don't you try by yourself? You can use: print repr(something)
--
Gabriel Genellina
i get <Tkinter.Canv as instance at 0x01B9B6E8>
thing is i get that even though i click outside the image.
and what can i do with this number anyway?
En Tue, 15 Apr 2008 20:45:24 -0300, <sk*******@yaho o.seescribió:
On 16 Apr, 00:24, "Gabriel Genellina" <gagsl-...@yahoo.com.a rwrote:
>En Tue, 15 Apr 2008 17:45:08 -0300, <skanem...@yaho o.seescribió:
when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)
def hmm(event):
return event.widget
Why don't you try by yourself? You can use: print repr(something)
i get <Tkinter.Canv as instance at 0x01B9B6E8>
thing is i get that even though i click outside the image.
So you answered your first question yourself: event.widget is the canvas,
not the bitmap.
On another thread you get the other answer.
and what can i do with this number anyway?
With that specific number, nothing. The whole text says two things:
- *what* the object is: a Tkinter.Canvas instance
- *which* one: this is not the same one as <Tkinter.Canv as instance at
0x12345678>
--
Gabriel Genellina
On 16 Apr, 01:45, skanem...@yahoo .se wrote:
On 16 Apr, 00:24, "Gabriel Genellina" <gagsl-...@yahoo.com.a rwrote:
En Tue, 15 Apr 2008 17:45:08 -0300, <skanem...@yaho o.seescribió:
when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)
def hmm(event):
* * return event.widget
Why don't you try by yourself? You can use: print repr(something)
--
Gabriel Genellina
i get <Tkinter.Canv as instance at 0x01B9B6E8>
thing is i get that even though i click outside the image.
and what can i do with this number anyway?- Nascondi testo tra virgolette -
- Mostra testo tra virgolette -
If your image is a canvas item (i.e. created with canvas create_image
method), then you can use
the method tag_bind to handle events specific of that item.
In that case, the callback argument is a Tkinter.Event instance.
Ciao
-----
FB This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Elaine Jackson |
last post by:
I've got a script where a button gets pushed over and over: to cut down on the
carpal tunnel syndrome I'd like to have the button respond to presses of the
Enter key as well as mouse clicks; can somebody clue me in regarding how this is
done? Muchas gracias.
Peace
|
by: Pekka Niiranen |
last post by:
Hi there,
after reading TkInter/thread -recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965
I wondered if it was possible to avoid using threads
for the following problem:
I have script started from W2K console that normally
prints ascii messages to the screen. However, I have
command line "debug" -flag that might cause printing
|
by: Tonino |
last post by:
Hi,
I have a small Tkinter app that gets data from a socket connection to a
"server". The app has a Text() widget to display the info that it gets
from the socket connection. I have the ability to stop the text at any
point.
What I want to be able todo is select a line from the Text() window and
double click or whatever on it to open a new window with that selected
text as a paramater to the new window.
|
by: Harlin Seritt |
last post by:
I am working on making something called a PopMsg widget which is
actually identical to a Balloon widget from Pmw. Here is the code:
---code---
from Tkinter import *
import time
class PopMsg:
def showmsg(self, event):
|
by: Christopher Subich |
last post by:
I'm building an application involving both twisted and Tkinter. Since
twisted co-opts <widget>.mainloop() in its reactor.run(), and since it
behaves very badly if the application quits without reactor.stop()
running, I attach the following function to '<Destroy>' in the main
window (root = Tk()):
def stop_reactor_bind(x):
reactor.stop()
Then:
| |
by: Grooooops |
last post by:
I've been hacking around this for a few days and have gotten close to
what I want... but not quite...
The TKinter Docs provide this example:
# configure text tag
text.tag_config("a", foreground="blue", underline=1)
text.tag_bind("a", "<Enter>", show_hand_cursor)
text.tag_bind("a", "<Leave>", show_arrow_cursor)
text.tag_bind("a", "<Button-1>", click)
text.config(cursor="arrow")
|
by: Avi Kak |
last post by:
Does Tkinter provide a function that returns all the event descriptors
for a given widget class? I am looking for something similar to what
you get in Perl/Tk when you call bind() with a single explicit
argument. For example, in Perl/Tk,
$widget->bind( Tk::Button )
returns a list like
<Key-Return>
|
by: WaterWalk |
last post by:
Hello. When I tried to make Tkinter canvas widget respond to
MouseWheel event on Windows XP, I failed. The canvas just doesn't
receive MouseWheel event. I used bind_all to find out which widget
receives this event and the result showed that only the top Tk widget
gets it. This is really annoying. I wonder if this problem exists on
other platform. I googled, but found no appliable solution, so I wrote
one as following. It's not perfect,...
|
by: Mudcat |
last post by:
I've tried quite a few things to get this correct but have hit a
couple of sticking points that I can't figure out. I need to ge the
Text box to function like the 'wraplength' option in a Label.
I've been able to adjust the height of the text by calculating the
number of lines needed to display the text. That's fairly simple. I
know the number of characters in the text and width of the box (which
is static). From that point I can...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |