Re: [Anygui-users] window.destroy() to terminate application.run() loop

Magnus Lie Hetland <[email protected]> Tue, 18 Mar 2003 18:13:46 +0100
Newsgroups gmane.comp.python.anygui.devel
Message-ID <[email protected]>
Clark, Chris <[email protected]>:
>
> Thanks for the advice, I appreciate it. I need to do some work as
> I've had chance to test under a win2k box and I get different
> results for tk (using the cvs version) compared with win98, i.e. tk
> using cvs version dloaded 6th March 2003 quits as expected. See
> below.

Sorry -- this email seems to have gotten lost in my inbox...

I'm forwarding it to the list, in case anyone has any idea what might
be wrong.

> > -----Original Message-----
> > From: Magnus Lie Hetland [mailto:[email protected]]
> > Clark, Chris <[email protected]>:
> > > However I've hit a problem with terminating the application (the OS
> > > close window works ok) I need to be able to close/terminate the
> > > application run loop.
> > 
> > There isn't really any way of doing that directly -- you have to close
> > all the windows.
> > 
> ....
> > > This works great under win32 (msw backend). However when I run the
> > > examples (and my code) under a different backend, say tk under win32
> > > (I'm using win98) or qt (on a Sharp Zaurus) the application loop
> > > does NOT terminate. I'm using anygui so I can deploy under a non msw
> > > backends :-) Is this a bug or a feature? Can I do anything about it
> > > in my code?
> > 
> > It sounds suspisciously like a bug... Have you tried
> > test/test_window.py? Just to see whether the loop exits when you close
> > all windows manually... (There may be something with the destroy
> > method.)
> > 
> 
> ...
> > If you've got the time, perhaps you could try out the CVS version?
> > There's a good chance that it's even less stable than 0.1.1, but,
> > pragmatically, there's a greater chance of getting any bugs fixed.
> > 
> 
> Yes and No :-) I dloaded the cvs version last night and it still
> behaves the same way with TK on my win98 (I've not tried the qt one
> on my Z though). As I mentioned above, works great under win2k that
> I was able to get access to. I need to do more research with the new
> cvs version. I'll update with my findings.
> 
> > > While I'm here I've another question on textarea's under qt (and tk)
> > > the multi-line text area has a scroll bar, under msw there is not
> > > scroll bar (you can use the curor keys to scroll the text area
> > > though) is there any way around this too?
> > 
> > Is there no scroll bar when you fill the text area with more lines
> > than it can hold?
> > 
> 
> Nope, the field is full with text, but no scroll bar in msw, works
> fine under tk and qt. A good example is test_textarea.py using msw
> as the backend. It's not a major problem but it is slightly annoying
> :-)
> 
> Below is the simple script I'm using for (quit) testing; I've also a
> version question, is there an attribute in anygui to check the
> version at runtime (I can't find one). Is there any plan for one?
> 
> Thanks,
> 
> Chris
> 
> REM --- Cut here ---
> REM win2k test batch file to change backend
> 
> set ANYGUI_WISHLIST=tk
> my_test_quit.py
> 
> REM --- Cut here ---
> 
> # --- Cut here ---
> from anygui import *
> 
> app = Application()
> 
> g_y = 150
> 
> win = Window(width = 110, height = 210)
> app.add(win)
> 
> # depending on anygui version change handler def.
> # cvs handler def, I guess 0.2a api?
> def my_quit(event):
> # 0.1.1 handler def
> #def my_quit(**kw):
>     print "Hello, world!"
>     win.destroy()
> 
> opt = Options(x = 30, width = 50, height = 30)
> btn = Button(opt, y = 30, text = "Quit")
> link(btn, 'click', my_quit)
> 
> win.add(btn)
> 
> app.run()
> 
> # print below won't run if the app.run() doesn't complete
> # from simple debugig it looks like the mainloop() in the backend never completes
> print "quit was successful"
> # --- Cut here ---

-- 
Magnus Lie Hetland               "Nothing shocks me. I'm a scientist." 
http://hetland.org                                   -- Indiana Jones


-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink? 
You could win a Tablet PC. Get a free Tablet PC hat just for playing. 
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en