Skip to content Skip to sidebar Skip to footer

Creating Clickable Areas On Screen With Pygtk

Hey guys I've run into a problem that I don't know how to solve. I just met with a team to design a GUI in python using PyGtk. I need to make a GUI that has clickable areas on scr

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"