jethro10
August 3rd, 2006, 10:15 AM
Hi,
I just starting on the Python/Glade train. Now I am a programmer, but getting started with this has been troublesome in the least!
I have a problem where the code below. It is only a fragment and mainly calles a function called parseqif() (it's a quicken export file) but got a strange error when updating a status label.
I added an extra button to experiment, called btnDisplay and when I click it, see btnDisplay_clicked, it opens a new window to display "yo" instead of on the current open window.
I've spent ages trying to figure out how to output back to a label or text box on my window and this is as far as i've got!
can anyone tell me how to reference my currently open window ?
I bet it's all about this 'self' thingy I see everywhere :???:
Thanks
Jeff
# main window class from GladeWrapper ==========================================
class mainWindow(libglade.GladeWrapper):
# grab widgets from xml ================================================
def __init__(self, Filename, WindowName):
libglade.GladeWrapper.__init__(self, Filename, WindowName)
def menuQuit(self, widget): # How a basic menu item works - the event the button raises
gtk.main_quit()
def btnQuit_clicked(self, widget): # How a basic button works
gtk.main_quit()
def btnRun_clicked(self, widget):
items = parseQif()
print repr(items[0])
outfile = open('outfile.csv','w')
for item in items[1:]:
print item.dataString()
outfile.write(item.dataString()+'\n')
outfile.close()
def btnDisplay_clicked(self, widget):
gtk.glade.XML("quicken.glade").get_widget("label1").set_text("yo")
# start the application ================================================== ======
mainWindow = mainWindow("quicken.glade", "mainWindow")
gtk.main()
# end of program ================================================== =============
I just starting on the Python/Glade train. Now I am a programmer, but getting started with this has been troublesome in the least!
I have a problem where the code below. It is only a fragment and mainly calles a function called parseqif() (it's a quicken export file) but got a strange error when updating a status label.
I added an extra button to experiment, called btnDisplay and when I click it, see btnDisplay_clicked, it opens a new window to display "yo" instead of on the current open window.
I've spent ages trying to figure out how to output back to a label or text box on my window and this is as far as i've got!
can anyone tell me how to reference my currently open window ?
I bet it's all about this 'self' thingy I see everywhere :???:
Thanks
Jeff
# main window class from GladeWrapper ==========================================
class mainWindow(libglade.GladeWrapper):
# grab widgets from xml ================================================
def __init__(self, Filename, WindowName):
libglade.GladeWrapper.__init__(self, Filename, WindowName)
def menuQuit(self, widget): # How a basic menu item works - the event the button raises
gtk.main_quit()
def btnQuit_clicked(self, widget): # How a basic button works
gtk.main_quit()
def btnRun_clicked(self, widget):
items = parseQif()
print repr(items[0])
outfile = open('outfile.csv','w')
for item in items[1:]:
print item.dataString()
outfile.write(item.dataString()+'\n')
outfile.close()
def btnDisplay_clicked(self, widget):
gtk.glade.XML("quicken.glade").get_widget("label1").set_text("yo")
# start the application ================================================== ======
mainWindow = mainWindow("quicken.glade", "mainWindow")
gtk.main()
# end of program ================================================== =============