Re: [pygtk] Compiling PyGTK2
[Thomas Leonard - Tue, 21 Jan 2003 05:10:56 AM CST] > Actually, it might be a PyGTK problem. Looks like the infamous > ref-counting bug ("this object is only referenced by signal handlers, so > I'm going to wipe __dict__"): > > http://bugzilla.gnome.org/show_bug.cgi?id=92955 I feel silly now. I was looking for pygtk/python-gtk in Gnome's bugzilla page, but not gnome-python, so never found pygtk's list of official bugs, so bothered you all earlier. And neglected to read James' GNOME page. Bah. The one link I didn't click. -- | The bomb will never go off. I speak as an expert in explosives. | -- Admiral William Leahy, U.S. Atomic Bomb Project ___ 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] instance.__dict__ disappears with many widgets
[John Finlay - Wed, 15 Jan 2003 03:03:46 PM CST] > I'm guessing that your ColorWidgets are somehow losing info because of > loss of references in python but I don't understand how PyGTK handles > memory in conjunction with python. That would definitely cause it I'm guessing that reference counting or something goes boinkers. > I fiddled with your test program and added a list of ColorWdigets to the > StyleBox instance - this seemed to fix things but I don't know exactly > why. It's a hack but may be a workaround. Thanks for the workaround. I did modify the full program to put every user-derived widget class into a list held by the main app window, and everything works again. -- | The aim of a joke is not to degrade the human being but to remind | him that he is already degraded. | -- George Orwell ___ 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] instance.__dict__ disappears with many widgets
[Ava Arachne Jarvis - Wed, 15 Jan 2003 05:25:54 AM CST] > I'm attaching a version of the program that I stripped down to about 50 > lines. Instruction for running this: It would help if I attached the program. Heh. Sorry. -- | BOFH excuse #105: | | UPS interrupted the server's power #!/usr/bin/python import pygtk pygtk.require('2.0') import gtk, sys, string class ColorWidget(gtk.Button): def __init__(self, stylebox): gtk.Button.__init__(self) self.stylebox = stylebox self.color = gtk.gdk.color_parse('white') self.set_size_request(30, 30) self.connect("clicked", self.setColor) def setBackground(self, gdkcolor = None): if gdkcolor: self.color = gdkcolor for state in [gtk.STATE_ACTIVE, gtk.STATE_NORMAL, gtk.STATE_PRELIGHT, gtk.STATE_SELECTED]: self.modify_bg(state, self.color) def setColor(self, w): print '__dict__:', self.__dict__ self.setBackground(self.stylebox.getColor(self.color)) class StyleBox(gtk.Window): def __init__(self, numwidgets = 10): gtk.Window.__init__(self) self.connect("destroy", lambda w: gtk.main_quit()) self.cdg = gtk.ColorSelectionDialog('Select Color') self.notebook = gtk.Notebook() self.notebook.set_show_tabs(0) self.add(self.notebook) for i in range(0, numwidgets): self.createTestPanel() def getColor(self, prev_color = None): if prev_color: self.cdg.colorsel.set_current_color(prev_color) color = None if self.cdg.run() == gtk.RESPONSE_OK: color = self.cdg.colorsel.get_current_color() self.cdg.hide() return color def createTestPanel(self): panel = gtk.Frame() self.notebook.append_page(panel, gtk.Label('Test')) panel.add(ColorWidget(self)) s = StyleBox(string.atoi(sys.argv[1])) s.show_all() gtk.main()
[pygtk] instance.__dict__ disappears with many widgets
I'm using python 2.2 and pygtk 1.99.14, gtk 2.2.0 and friends. I'm running across an odd problem when I use a large number of widgets, and some of them are ones that inherit from original gtk widgets. When first created, these objects seem intact; however, the first time a signal callback is called, the objects' attribute dictionaries are empty. I'm attaching a version of the program that I stripped down to about 50 lines. Instruction for running this: python stripped.py Basically, this program makes a bunch of notebook pages, each with a button that lets you set its color (the notebook tabs are hidden so that the thing isn't huge). The clicked signal callback prints out the object's attribute dictionary and then attempts to set the color via calling the dialog, which belongs to the main window. Compare 'python stripped.py 10' versus 'python stripped.py 80'. 80 color buttons is an extravagant amount, but 80 widgets of various types is not so extravagant. I'm definitely not running out of memory; nor am I using threads in my own code. I've searched the PyGTK FAQ for 'many widgets', 'inheritance', 'subclass', and 'ExtensionClass' (from browsing search results from the mailing list) but I didn't find an answer. Is this a known problem, and is there a workaround? Or am I just doing something wrong? Thanks. -- | Lackland's Laws: | (1) Never be first. (2) Never be last. (3) Never volunteer | for anything ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/