Problem with timing, again:

Jeremy Moles xione at bellsouth.net
Sun Jul 29 04:12:34 EDT 2001


I had an earlier post about timing in a program. Well, this is what I have
so far - exactly. It works, but it won't respond, and it won't let the
button go. What am I doing wrong?

____________________________________________

from Tkinter import *

class App:

    def __init__(self, master):

        frame = Frame(master)
        frame.pack()

        self.hi_there = Button(frame, text='Upload',
command=self.dostuff).pack()

    def dostuff(self):
      import socket,ftplib,time
      x=socket.gethostbyname(socket.gethostname())
      y=open('D:\\Python\\IP.html','w')
      y.write(x)
      y.close()
      def domorestuff():
         z=ftplib.FTP(host='ahost')
         z.login(user='asuer',passwd='apassword')
         z.cwd('public_html')
         z.storlines('STOR IP.html',open('D:\\Python\\IP.html','r'))
         z.close()
      while 1:
         domorestuff()
         time.sleep(15)

root = Tk()
root.title('IPUL')

app = App(root)

root.mainloop()

_______________________________________________

Anyways, the program works - but the gui itself freezes up - it's as if the
button is stuck. You guys were so helpful last time, any advice this time?






More information about the Python-list mailing list