[pygtk] Segfault with popup menus

2001-11-19 Thread Paul Brannan

With this program:

  from gtk import *

  def button_press(widget, event):
if event.button == 3:
  menu = GtkMenu()
  menu.append(GtkMenuItem('foo'))
  menu.append(GtkMenuItem('bar'))
  menu.popup(widget, None, None, event.button, event.time)

  window = GtkWindow(WINDOW_TOPLEVEL)
  window.connect('destroy', mainquit)

  button = GtkButton('foo')
  button.connect('button-press-event', button_press)
  window.add(button)

  button.show()
  window.show()

  mainloop()

I run the program, then right-click on the button, and I get this:

  [pbrannan@zaphod python]$ python test.py
  Segmentation fault (core dumped)

Looking at this in gdb, I see:

  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 1024 (LWP 23769)]
  0x4028e1d7 in gtk_menu_popup () from /usr/lib/libgtk-1.2.so.0
  (gdb) bt
  #0  0x4028e1d7 in gtk_menu_popup () from /usr/lib/libgtk-1.2.so.0
  #1  0x401be26a in _wrap_gtk_menu_popup (self=0x0, args=0x8123fec)
  at gtkmodule.c:5084
  #2  0x08059702 in call_cfunction (func=0x813e930, arg=0x8123fec, kw=0x0)
  at Python/ceval.c:2845
  ...

I have no idea what's causing self=0x0, but I suspect that's why the
program is segfaulting.

A couple of questions:

  1) Is there an easier way to get a popup menu?
  2) How can I rewrite the above code to not segfault?

Thanks,

Paul



___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] GtkTree examples?

2001-11-19 Thread Christian Robottom Reis

On Mon, 19 Nov 2001, Michael Gilfix wrote:

   Hi all. Could someone please post a simple example of using GtkTree?
 I found the one example provided with pygtk that uses it difficult
 to follow as it seems to play some tricks with dicts. I'm looking to
 build a tree recursively out of directories. Some hints would be
 great.

Don't use GtkTree, use GtkCTree.
See the Kiwi codebase for an example of realworld usage
(http://www.async.com.br/kiwi/)

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] Segfault with popup menus

2001-11-19 Thread John Finlay

Paul,

Pass in None instead of widget as the first arg to menu.popup. Also need to
have the menu displayed. Changes below.

John

from gtk import *

def button_press(widget, event):
  if event.button == 3:
menu = GtkMenu()
menu.append(GtkMenuItem('foo'))
menu.append(GtkMenuItem('bar'))
menu.show_all()
menu.popup(None, None, None, event.button, event.time)

window = GtkWindow(WINDOW_TOPLEVEL)
window.connect('destroy', mainquit)

button = GtkButton('foo')
button.connect('button-press-event', button_press)
window.add(button)

button.show()
window.show()

mainloop()


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] GtkTree examples?

2001-11-19 Thread Jon Nelson

On Mon, 19 Nov 2001 17:08:02 -0200 (BRST)
Christian Robottom Reis [EMAIL PROTECTED] wrote:

 On Mon, 19 Nov 2001, Michael Gilfix wrote:
 
Hi all. Could someone please post a simple example of using
GtkTree?
  I found the one example provided with pygtk that uses it
difficult
  to follow as it seems to play some tricks with dicts. I'm
looking to
  build a tree recursively out of directories. Some hints would
be
  great.
 
 Don't use GtkTree, use GtkCTree.
 See the Kiwi codebase for an example of realworld usage
 (http://www.async.com.br/kiwi/)

Ah, but GtkCTree can't handle non-text items (like buttons,
entry fields, etc...)


-- 
Jon Nelson\|/  \|/   Gort,
[EMAIL PROTECTED]@'/ ,. \`@   Klaatu
C and Python Programmer   /_| \__/ |_\   barada
Motorcycle Enthusiast\__U_/  nikto.
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] GtkTree examples?

2001-11-19 Thread Michael Gilfix

  Thanks for the pointers. I haven't tried it out yet but it looks
like it'll do the trick. I just want to be able to display pixmaps
with the text and it supports just that.

 -- Mike

On Mon, Nov 19 @ 13:45, Jon Nelson wrote:
 On Mon, 19 Nov 2001 17:08:02 -0200 (BRST)
 Christian Robottom Reis [EMAIL PROTECTED] wrote:
 
  On Mon, 19 Nov 2001, Michael Gilfix wrote:
  
 Hi all. Could someone please post a simple example of using
 GtkTree?
   I found the one example provided with pygtk that uses it
 difficult
   to follow as it seems to play some tricks with dicts. I'm
 looking to
   build a tree recursively out of directories. Some hints would
 be
   great.
  
  Don't use GtkTree, use GtkCTree.
  See the Kiwi codebase for an example of realworld usage
  (http://www.async.com.br/kiwi/)
 
 Ah, but GtkCTree can't handle non-text items (like buttons,
 entry fields, etc...)
 
 
 -- 
 Jon Nelson\|/  \|/   Gort,
 [EMAIL PROTECTED]@'/ ,. \`@   Klaatu
 C and Python Programmer   /_| \__/ |_\   barada
 Motorcycle Enthusiast\__U_/  nikto.
`- (jnelson)

-- 
Michael Gilfix
[EMAIL PROTECTED]
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



[pygtk] Greetings!

2001-11-19 Thread Brian Allbee

Greetings! I'm a Python/pygtk newbie, looking for documentation (or
outright help ::grin::). I'm working on a program where I'd like to be
able to swap window-widget sub-sets around with other pre-defined widget
sub-sets, if this is possible.

I'm not sure how to explain exactly what I'm trying to do, so I'll spew
out a quick example. Starting with the window pictured at
http://linus.smenet.org/~ballbee/pygtklist/main_window.gif
I'd like to have it load the widget-set from another window, pictured at
http://linus.smenet.org/~ballbee/pygtklist/log_in_form.gif
into the viewport on the right on launch, and after a successful log-in,
swap _that_ widget-set out (again) with the widget-set shown at
http://linus.smenet.org/~ballbee/pygtklist/chronicle_properties.gif

Hope that makes sense...

Any help would be appreciated (even if it's a RTFM comment, if you can
tell me where TFM is ::grin::)

+--+
| Brian Allbee |
| [EMAIL PROTECTED]   |
+--+
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] Greetings!

2001-11-19 Thread Christian Robottom Reis

On 19 Nov 2001, Brian Allbee wrote:

 I'm not sure how to explain exactly what I'm trying to do, so I'll spew
 out a quick example. Starting with the window pictured at
 http://linus.smenet.org/~ballbee/pygtklist/main_window.gif
 I'd like to have it load the widget-set from another window, pictured at
 http://linus.smenet.org/~ballbee/pygtklist/log_in_form.gif
 into the viewport on the right on launch, and after a successful log-in,
 swap _that_ widget-set out (again) with the widget-set shown at
 http://linus.smenet.org/~ballbee/pygtklist/chronicle_properties.gif

Question: is this using libglade or plain pygtk? If it's plain pygtk, all
you have to do, really, is use the remove() and add() methods of
GtkContainer. Ideally, you use a placeholder widget, use something like:

p = widget['parent']
p.remove(widget)
p.add(newwidget)

Btw: there is no real manual, right now. I'm working on a FAQ (late late
late) and there is a lot of code and examples to study.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] Greetings!

2001-11-19 Thread Brian Allbee

This'd be using libglade (or so I presume, as the interface-prototypes
were generated with glade).

No manual? Hurm... Is there a (reasonably) complete list of
objects/methods/properties available anywhere?

On Mon, 2001-11-19 at 14:47, Christian Robottom Reis wrote:
 On 19 Nov 2001, Brian Allbee wrote:
 
  I'm not sure how to explain exactly what I'm trying to do, so I'll spew
  out a quick example. Starting with the window pictured at
  http://linus.smenet.org/~ballbee/pygtklist/main_window.gif
  I'd like to have it load the widget-set from another window, pictured at
  http://linus.smenet.org/~ballbee/pygtklist/log_in_form.gif
  into the viewport on the right on launch, and after a successful log-in,
  swap _that_ widget-set out (again) with the widget-set shown at
  http://linus.smenet.org/~ballbee/pygtklist/chronicle_properties.gif
 
 Question: is this using libglade or plain pygtk? If it's plain pygtk, all
 you have to do, really, is use the remove() and add() methods of
 GtkContainer. Ideally, you use a placeholder widget, use something like:
 
 p = widget['parent']
 p.remove(widget)
 p.add(newwidget)
 
 Btw: there is no real manual, right now. I'm working on a FAQ (late late
 late) and there is a lot of code and examples to study.
 
 Take care,
 --
 Christian Reis, Senior Engineer, Async Open Source, Brazil.
 http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL
 
 ___
 pygtk mailing list   [EMAIL PROTECTED]
 http://www.daa.com.au/mailman/listinfo/pygtk
-- 
+--+
| Brian Allbee |
| [EMAIL PROTECTED]   |
+--+
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



[pygtk] Tooltips in CList cells/rows

2001-11-19 Thread Christian Storgaard

I am currently writing a CD player using pygtk and want to popup a tooltip over
each track in my CList containing the full title of the track if it's not fully
visible normally.

I know how to do it all except attaching the tooltip to the cell/row.
It should be something like:
tt.set_tip(clist.get_row_data(track)
But get_row_data() returns nothing, so how do I do it?

Anyone?
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] How to get the HWND on win32 (to embed a vtk render window)?

2001-11-19 Thread Hans Breuer

At 11:21 07.11.01 +1100, David Pinson wrote:
I'm using pygtk + vtk on win32 with python 2.1

 [...]

It might be as simple as replacing 

str (self.box.get_window ().xid)
with 
str (self.box.get_window ().hwnd)

but I am not sure.

Ok, so looking at the pygtk sources I see that in PyGdkWindow_GetAttr:
#ifdef WITH_XSTUFF
if (!strcmp(key, xid))
return PyInt_FromLong(GDK_WINDOW_XWINDOW(win));
#endif

So is there a way I can get the HWND I need fro win32?

#include gdk/win32/gdkwin32.h
GDK_DRAWABLE_XID(win)

with the early Gtk 1.3 (win32-production).

GDK_WINDOW_HWND (win)
with the upcoming Gtk 2.0 (current cvs)

Hans
 Hans at Breuer dot Org ---
Tell me what you need, and I'll tell you how to 
get along without it.-- Dilbert
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] CTree and checkboxes

2001-11-19 Thread Johan Dahlin

ons 2001-11-14 klockan 19.47 skrev Christian Robottom Reis:
 On Wed, 14 Nov 2001, Jon Nelson wrote:
 
  Is it possible to add checkboxes to CTree nodes?
  What I want looks like this:
 
  + blah blah
| some more text X checkbox  0 unchecked_box
 
 Not with the CTree you can't. I think the TreeView widget in gtk2 might be
 better, but i know right now you can't.
 
 If using Gnome and GAL is an option, You might want to try and check out
 GAL for that; IIRC you can add any widget you like to the ETable, but as
 always IMBW. Johan?
 
 If you find that GAL has what you want, you can try using Johan's
 gal-python module; just ask him for the latest version. :-)
Use pygtk2 and GtkTextView instead.
Much nicer.

example can be found (module gnome-python, GNOMECVS)
pygtk/examples/pygtk-demo/list_store.py

 
 Take care,
 --
 Christian Reis, Senior Engineer, Async Open Source, Brazil.
 http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL
 
 


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk