I'm trying to make a button that, when pressed gives a popup menu that has the top left corner aligned with the top left corner of the button (i.e. I want to create a modified GtkOptionMenu where there are no arrows and it is activated by a button press).
The call back below _almost_ works. The popup has the correct x coordinate, but the y coordinate is not correct.
One thing that I am not sure of is whether I can or should do anything with the GtkMenu.attach_to_widget method. I'm not really sure what this does...
Has anyone else had any success doing this?
thanks
Richard
def on_new_strategy_button_press_event(button, event):
# Get the position of the button within the window
allocation = button.get_allocation() # Get the position of the window
(x, y) = button.get_parent_window().get_root_origin() def positionFunction(menu):
# Return the top-left corner of the button
return (x+allocation.x, y+allocation.y, gtk.FALSE) # Get the menu (defined elsewhere via glade)
strategyMenu = xml.get_widget("strategyMenu")
strategyMenu.popup(None, None, positionFunction, event.button, event.time)_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
