On Aug 16, 2006, at 8:05 AM, Rafal Janas wrote: > Hi. > > I create simple program using glade and GladeGen. > In main.py is main class and in wind.py is wind class. > In main class is entry1 and button1. When I click on button1 I open > wind > class wind.Wind() > In wind class is entry1 field when I type some values and how can I > send > this value to main class. > When I type main.Main().widgets['entry1'].set_text("something") it > open > new class but I want do it in window which is open > How to do it?
I assume you're referring to GladeGen that was in Linux Journal (July 2004 I think) - I'm the person who wrote it. main.Main() creates a new instance of the class, but you want to use the existing instance. A simple way around this is to pass the instance of the main class to the wind class when you create it. Assuming you're in a method of the main class when you create it do something like: self.wind = wind(self) and then your wind constructor includes: def __init__(self, main): self.main = main and then in your wind method that you want to set the text entry, you write: self.main.widgets['entry1].set_text('something') HTH, Dave -- http://mail.python.org/mailman/listinfo/python-list