Can anyone tell me if pygame and Tkinter can work together in the same
application? I thought I'd better ask before trying it, since both use
widgets.
Thanks,
Nathan Pinno
--
For great sites go to: http://www.the-web-surfers-store.com
MSN Messenger: falcon3166@hotmail,com
Yahoo! Messenger: spam_swatter31
ICQ: 199020705
AIM: f3mighty
--
.............................................................
> Posted thru AtlantisNews - Explore EVERY Newsgroup <
> http://www.AtlantisNews.com -- Lightning Fast!!! <
> Access the Most Content * No Limits * Best Service <
Jeff
Nathan Pinno
Nathan Pinno,
Owner/operator of The Web Surfer's Store.
http://www.the-web-surfers-store.com/
MSN Messenger: falco...@hotmail.com
Yahoo! Messenger: spam_swatter31
AIM: f3mighty
ICQ: 199020705
This is more likely to work than the scenario I first considered, where both
GUI libraries would be in use at the same time.
With my understanding of how X works, and my knowledge of Tk, you'd probably be
successful if what you want to do is first use GUI Library A, and then GUI
Library B. This resolves the issue with XSetErrorHandler, for instance,
because you'll be completely done with Library A at the time you call the
initialization routines of Library B. It also resolves the event loop problem,
because you never need to allow Libraries A and B to receive events during the
same phase of the program.
I don't know anything about Windows, and I haven't actually given this scenario
a try on Linux either, so it's still all idle speculation on my part. Actual
experimentation on your part wouldn't be that hard, though. Just write the
simplest possible Tk program as a callable function 't()' and the simplest possible
pygame program as a callable function 'p()', and then see what happens when you run
them back to back:
def t():
import Tkinter
t = Tkinter.Tk()
Tkinter.Button(t, command = t.destroy).pack()
t.mainloop()
def p():
likewise
t()
p()
Jeff
Nathan Pinno,
Owner/operator of The Web Surfer's Store.
http://www.the-web-surfers-store.com/
MSN Messenger: falco...@hotmail.com
Yahoo! Messenger: spam_swatter31
AIM: f3mighty
ICQ: 199020705
-----Original Message-----
From: jep...@unpythonic.net [mailto:jep...@unpythonic.net]
Sent: November 15, 2005 8:47 PM
To: Nathan Pinno
Cc: pytho...@python.org
Subject: Re: Can anyone tell me if pygame and Tkinter can work together?
from Tkinter (or pygame) import *
Anyway around this little bug?
--
For great sites go to: http://www.the-web-surfers-store.com
MSN Messenger: falcon3166@hotmail,com
Yahoo! Messenger: spam_swatter31
ICQ: 199020705
AIM: f3mighty
"Nathan Pinno" <falco...@hotmail.com> wrote in message
news:mailman.724.11321163...@python.org...
--
What's the error?
--
Cheers,
Simon B,
si...@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Can only use * in top level or something like that.
It's kind of annoying, but the program still ran after I made the import *
lines top level, and removed the def's.
Nathan Pinno.
--
For great sites go to: http://www.the-web-surfers-store.com
MSN Messenger: falcon3166@hotmail,com
Yahoo! Messenger: spam_swatter31
ICQ: 199020705
AIM: f3mighty
"Simon Brunning" <simon.b...@gmail.com> wrote in message
news:mailman.736.11321405...@python.org...
What's the error?
--
> It's a warning that says:
>
> Can only use * in top level or something like that.
>
> It's kind of annoying
why? importing tons of unknown stuff into a local namespace is
rather silly, and makes it impossible for the compiler to properly
analyze your code -- which means that you cannot use nested
scoping. the language reference says:
The from form with "*" may only occur in a module scope.
If the wild card form of import -- "import *" -- is used in a
function and the function contains or is a nested block with
free variables, the compiler will raise a SyntaxError.
future versions of Python will most likely issue a SyntaxError also
for "import *" in non-nested functions.
> but the program still ran after I made the import * lines top level,
> and removed the def's.
moving the "import *" line to the module scope would have been
enough; functions can refer to module-level variables just fine.
you might wish to read up on Python scoping rules:
http://docs.python.org/ref/naming.html
</F>
--
For great sites go to: http://www.the-web-surfers-store.com
MSN Messenger: falcon3166@hotmail,com
Yahoo! Messenger: spam_swatter31
ICQ: 199020705
AIM: f3mighty
"Fredrik Lundh" <fre...@pythonware.com> wrote in message
news:mailman.757.11321718...@python.org...
--