[pygtk] attach_to_widget and popup menus

2003-10-03 Thread Richard Black
Hi all,

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/


[pygtk] scrolling drawing area

2003-10-03 Thread Michal Nowikowski
Heya

I'd like to scroll drawing area in a window. Its size is much bigger than
a size of screen, so I need some scroll rulers. I've found such objects
like GtkLayout, GtkScrollwindow and GtkViewport. Is it possible to use
them to scroll drawing area? How can I do that?

Best regard
godfryd

-- 
|  Michal Nowikowski [EMAIL PROTECTED]
|  BOFH excuse #445: Browser's cookie is corrupted -- someone's been
|  nibbling on it.
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] scrolling drawing area

2003-10-03 Thread Christian Reis
On Fri, Oct 03, 2003 at 10:07:40PM +0200, Michal Nowikowski wrote:
 like GtkLayout, GtkScrollwindow and GtkViewport. Is it possible to use
 them to scroll drawing area? How can I do that?

GtkScrolledWindow should do what you want -- just put your DA inside it
(it's a container) and set its size.

Take care,
--
Christian Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] delete selection

2003-10-03 Thread Christian Reis
On Wed, Oct 01, 2003 at 01:46:50PM -0700, Yang Zheng wrote:
 I've figured out how to delete multiple selections.  If anyone runs into

- FAQ 13.22

http://www.async.com.br/faq/pygtk/index.py?req=showfile=faq13.022.htp

If you see anything wrong or worth improving, feel free to hack it :-)

Take care,
--
Christian Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/