<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffff99" text="#000000">
<font face="Andale Mono">Gentlemen,<br>
<br>
I don't consider myself a rank beginner (I did take a shower this
week), but I've been beating my brains out over this for the past week.<br>
<br>
I'm writing this GUI app (Tkinter).&nbsp; Just about everything is done (all
the nuts,bolts, and the occasional nail.&nbsp; Now Im trying to code a
simple status window to let the dumb user (me) know what's going on
behind the curtain.&nbsp; The idea is, the application calls the subroutine,
the subroutine pops open a frame and print some text in it, then
returns control back to the&nbsp; main app - leaving the frame/text
visible.&nbsp; Then, the app calls the subroutine and *updates* the frame,
so you end up with a growing list of notices...(basically, I'm working
with a variable set of files, and it's convenient to know which is
being operated on)<br>
<br>
I've ripped code from Mark Lutz's book (3rd edition), from Welch's book
(also 3rd edition), and from around the net. It seems to me that I'm
missing something obvious when it comes to self.update.&nbsp; The subroutine
works as advertised the first time through, but one the window is open
and the text displays, the app stops - unless I close the window.&nbsp; Of
course, then everything works until the NEXT message is displayed.<br>
<br>
Sure, I could add a button and work from that, but I don't *WANT* to -
the idea is a (more or less) continuous flow of information that I can
scroll through if need be.<br>
<br>
As you can see from the sample code below, I'm using the Text widget
instead of Message.&nbsp; I had a reason for that when I started this
nightmare, but I'm not wedded to it.<br>
<br>
Any assistance from anybody would be much appreciated.<br>
<br>
Thanks in advance!<br>
<br>
Erik<br>
<br>
-----------------------<br>
<br>
from Tkinter import *<br>
<br>
data={}<br>
data[4,9]="you are here"<br>
data[4,10]=0<br>
msg=1<br>
x={}<br>
<br>
def loop():<br>
&nbsp;&nbsp;&nbsp; global x<br>
&nbsp;&nbsp;&nbsp; x[1]=0<br>
&nbsp;&nbsp;&nbsp; while x[1]&lt;10:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; messages(x)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; print "howdee"<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; x[1]=x[1]+1<br>
<br>
def messages(msg):<br>
&nbsp;&nbsp;&nbsp; class MESSAGES(Frame):<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; def __init__(self,parent=None,text='', file=None):<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Frame.__init__(self,parent)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.pack(expand=YES,fill=BOTH)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.makewidgets()<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.message(text)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.update()<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; def makewidgets(self):<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sbar=Scrollbar(self)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; a=Text(self,relief=RAISED)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sbar.config(command=a.yview,bg='#fcfcfc')<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; a.config(yscrollcommand=sbar.set,bg='#f0f0f0')<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sbar.pack(side=RIGHT,fill=Y)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; a.pack(side=LEFT,expand=YES,fill=BOTH)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.a=a<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; data[4,10]=1<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; def message(self,text):<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.a.insert(END,text)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.a.focus()<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return self.a.get('35.2',END+'-1c')<br>
<br>
&nbsp;&nbsp;&nbsp; if __name__=='__main__':<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; root=Tk()<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MESSAGES(text=data[4,9]).mainloop()<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
loop()<br>
<br>
I've tried this small mod, just now, but it *really* breaks things the
second time through:<br>
<br>
<br>
&nbsp;&nbsp;&nbsp; class MESSAGES(Frame):<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; def __init__(self,parent=None,text='', file=None):<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Frame.__init__(self,parent)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.pack(expand=YES,fill=BOTH)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if data[4,10]==0:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.makewidgets()<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.message(text)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self.update<br>
<br>
</font>
</body>
</html>