On 19/09/03 16:37, [EMAIL PROTECTED] wrote:

Hi to all,
I've a Window with a TextView, and I want to display another window (a popup
winow) near the cursor position of the TextView. So I've calculate the cursor
position with the buffer_to_window_coords() method and then I try to use the
method get_position() of the Window to obtain the window position on the screen.
The problem is that get_position() alwais return (0,0) to me, why?

The following piece of code is what I'm using

buffer=self.text_view.get_buffer()
iter=buffer.get_iter_at_mark(buffer.get_insert())
rectangle=self.text_view.get_iter_location(iter)
absX, absY=self.text_view.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT, rectangle.x ,rectangle.y)
print absX, absY
self.window.show_all()
winX, winY=self.popup.get_position()
print winX, winY


and it prints

43 32 #of course theese values can be different
0 0

Any ideas or suggestions?


The position of the window is relative to the parent window. If you want the position relative to the root window, you can use the get_root_origin() method.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to