[Tkinter-discuss] Exit from method loop

Paul Simon psimon at sonic.net
Thu Apr 11 05:58:52 CEST 2013


Andreas,

Thanks very much for the response to my question.  Using threading is beyond my programming capability and since I am only occasionally programming would not be worth my time to learn.  I'm not clear about the second suggestion you made and would appreciate some clarification.

At the moment my intuition is telling me that the sleep statement is the source of the problem, as it might interfere with the check button selection, and the rest of the loop is too fast to catch the "click."  I'm going to replace "sleep" with a time delta construction and see if that works any better.

Paul
  "Andreas Ostermann" <andreas.ostermann.11 at googlemail.com> wrote in message news:CANs6TN+p4YUcqzkrWnfwqaTKvC1_rp5vXhxsgOgKgFYCnUibLA at mail.gmail.com...
  Hi,


  if it should loop continuously, why don't you put it into a background thread?


  Or, as you are using sleep() remove the loop and use root.after() to invoce the check method every now and then...


  brgds,


  AO





  2013/4/9 Paul Simon <psimon at sonic.net>

    Hi All,

    I've attaached code simplified from my "opus" and have a problem.  I would
    like to exit from "read_sensor" into the main loop.  I cannot access the
    "stop" check button or the "quit" button while the intenal loop in
    "read_sensor" is running.  The internal loop is intended to run continuously
    until interrupted by the "stop" button but for demo purposes it is set to 10
    interations.

    Paul Simon




    _______________________________________________
    Tkinter-discuss mailing list
    Tkinter-discuss at python.org
    http://mail.python.org/mailman/listinfo/tkinter-discuss





------------------------------------------------------------------------------


  _______________________________________________
  Tkinter-discuss mailing list
  Tkinter-discuss at python.org
  http://mail.python.org/mailman/listinfo/tkinter-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20130410/a9e334c2/attachment.html>


More information about the Tkinter-discuss mailing list