gtk.gdk.threads_init and paste

From: Daniel Carvalho <idnael_at_gmail.com>
Date: Mon Feb 16 2009 - 12:25:21 CET

hello

if I enable multiple threads in pygtk (using the gtk.gdk.threads_init
function), there is a problem when I paste to the abiword widget. The
program stops responding.

This happens if the program calls the abiwordCanvas paste function or
if the user press the shift-insert key inside the editor.

I'm using:
Ubuntu 8.10
Kernel 2.6.27-11-generic
python-gtk2-2.13.0
pyabiword-0.6.1
abiword-2.6.4

Any idea?

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pygtk
pygtk.require('2.0')
import gtk

import abiword

# if you uncomment this line, the app will freeze if you do paste

# see
# http://www.moeraki.com/pygtktutorial/pygtk2reference/gdk-functions.html#function-gdk--threads-init
gtk.gdk.threads_init()

window=gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_default_size(640, 480)

box=gtk.VBox(False,5)
box.show()
window.add(box)

editor=abiword.Canvas()

b=gtk.Button("paste")
b.show()
def paste_cb(w,u=None):
    editor.paste()
b.connect("clicked", paste_cb, None)

box.add(editor)
box.pack_end(b,False,False)

window.show_all()
gtk.main()
Received on Mon Feb 16 12:34:45 2009

This archive was generated by hypermail 2.1.8 : Mon Feb 16 2009 - 12:34:45 CET