Creating frames in threads

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Greschke

    Creating frames in threads

    I have a program that creates one or more frames with

    TF = TopLevel(Root)

    talks to some equipment, calculates some stuff, draws a graph on a canvas in
    the frame, then exits. The frame/s goes with the thread and disappears when
    the thread is finished -- which I guess makes sense. Is there a way to keep
    those frames around after the thread is gone?

    Thanks!

    Bob




    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • Bob Greschke

    #2
    Re: Creating frames in threads

    I'm having trouble in another thread with scroll bars and threads on
    Windows, and the problem in this newsgroup thread ALSO seems to be a
    Windows(XP) Python 2.3.3-only problem. The same program on Linux and
    Solaris is fine.

    ???

    "Bob Greschke" <bob@passcal.nm t.edu> wrote in message
    news:404fa386$1 _6@corp.newsgro ups.com...[color=blue]
    > I have a program that creates one or more frames with
    >
    > TF = TopLevel(Root)
    >
    > talks to some equipment, calculates some stuff, draws a graph on a canvas[/color]
    in[color=blue]
    > the frame, then exits. The frame/s goes with the thread and disappears[/color]
    when[color=blue]
    > the thread is finished -- which I guess makes sense. Is there a way to[/color]
    keep[color=blue]
    > those frames around after the thread is gone?
    >
    > Thanks!
    >
    > Bob
    >
    >
    >
    >
    > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    > -----== Over 100,000 Newsgroups - 19 Different Servers! =-----[/color]




    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

    Comment

    • Eric Brunel

      #3
      Re: Creating frames in threads

      Bob Greschke wrote:[color=blue]
      > I have a program that creates one or more frames with
      >
      > TF = TopLevel(Root)
      >
      > talks to some equipment, calculates some stuff, draws a graph on a canvas in
      > the frame, then exits. The frame/s goes with the thread and disappears when
      > the thread is finished -- which I guess makes sense. Is there a way to keep
      > those frames around after the thread is gone?[/color]

      Do you mean that the "frame" (I'd call it a window, but nevermind...) is created
      by the thread? If it is, please be aware that there are some issues regarding
      Tkinter and threads. To keep it simple, it is better to leave all Tkinter
      related stuff in one thread (the main thread is a good candidate) and to
      communicate via this thread via Tkinter events using the event_generate method
      and Queue(s). You're for the moment in a situation where accessing Tkinter from
      multiple threads seems to work, but you may get stuck in the future.

      For your particular problem, I'd create the frames outside of the thread and use
      event_generate and a Queue to pass the information to display to the main
      thread, which would actually display it on the Canvas. This will make the design
      heavier, but you'll be sure that you won't have any problem in the future.

      HTH
      --
      - Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
      PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com

      Comment

      Working...