Creating Clickable Areas On Screen With Pygtk
Solution 1:
If you only need to get feedback of the click, then using a GtkDrawingArea
and listening there for mouse clicks would be enough. You won't need to use a static image for that, you can just use cairo and draw yourself the shape, based on the size of the drawing area, so that it always has the shape you want.
However, if you have planned to use massive mouse interaction there (drag and drop of shapes, etc.), then using a canvas like GooCanvas would be the preferred way to go.
Be also aware that pyGTK is for GTK 2 only, available under Linux and Windows, but it's obsoleted by pyGObject for GTK 3 (on Linux, as there's currently no official all-in-one installer of pyGObject for Windows).
To draw in a GtkDrawingArea
, you'll use the expose-event
signal on GTK 2, and the draw
signal on GTK 3.
Post a Comment for "Creating Clickable Areas On Screen With Pygtk"