[Tutor] Tkinter and moving round button
Alan Gauld
alan.gauld at btinternet.com
Fri Mar 21 22:21:17 CET 2014
On 21/03/14 03:31, cast fun wrote:
> I am trying to write a UI with text entry box for user input, buttons,
> and a moving circle when clicked popping up a new UI window. I was
> thinking Pygame, but didn't know how to show the text entry box. I am
> now using Tkinter, which is easy for the widgets, but the problem is the
> moving circle with the click event.
While basic Tkinter usage is within our scope I suspect you
may be better off pointing this one at the Tkinter mailing
list (and maybe the pygame list too?) since it is very
specific to Tkinter.
> 1. Can I use Sprite in Tkinter and if so how about the click event on
> the Sprite?
>
> 2. The other way I am thinking is in Tkinter, drawing a moving circle on
> the canvas, but don't know how to detect the click event to pop up a new
> window.
The click event in a canvass is easily enough detected
by binding to the mouse button events and reading the
event information to find out where the mouse is and
then determining whether it is within your circle (I
seem to recall a shape method that tells you if a
point is inside the boundary... but that might not
have been in tkinter).
> 3. Or better in Tkinter if I can use a round button as the circle. I
> tried the image button. The rectangle border was always there, not
> really a round button.
I don't know of any non rectangular widgets in Tkinter.
The canvas might be the best option here. But I'd try the Tkinter
mailing list. (If you cant find it, it is listed on the
gmane.org news server as gmane.comp.python.tkinter)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list