shoving a [pygame] up your [gtk]!

2006-07-05 Thread Lunpa
My project:
I'm working on a game, where in the ui, it takes the pygame window, and
shoves it into a gtk2 socket widget.  (gtk2 widgets are generated with
glade, with the exception of the socket widget, which is manualy added
into a window)

My problem:
Since adding the gtk half, it is realy slow.  I can make one or the
other update realy fast, or I can make it so the pygame window/widget
gets a fluctuation in framerate between realy good, then realy bad,
repeat.
I've narrowed down my problem a bit to my events loop.

Here's a simplified version of the events loop:

while True:
gtk.main_iteration(block=False)
game_board.clock.tick(75)
game_board.frame()

game_board is a class defining pygame/opengl code that produces the
pygame window, and a simple game engine (its actualy a place holder
untill I can make it run full speed.  think of something with the
sophistication of the pygame chimp example, or a opengl hello world).
The same unmodified engine (pure pygame/opengl, no gtk2) works fine.

game_board.frame() performs some game logic tasks, and updates the
pygame display.  It also handles some keyboard inputs, but only grabs
the latest one on the pygame stack.


So here's the problem sumary, as far as I can gather:
What I think is happening is that gtk.main_iteration(block=False) works
through every event in the queue untill there aren't any, THEN the
pygame event loop briefly fires, checks one or two events from the
pygame queue, and the loop repeats.
(An intresting varriation to the loop above only allowed
gtk.main_iteration to run when the pygame framerate is above 60... this
resulted in the two taking turns monopolising cpu, heh)

Here's what I think I want to do:
I'm looking for something to the equivalent of processing the one gtk
event (and remove it from it's stack), and then call
game_board.frame(), and have the loop repeate, possibly with some load
balancing to allow multiple gtk events to process if the framerate is
high.  However, this is where I've hit a wall.



So here we go.

If I'm correct in my assumptions, how can I break down gtk.main even
further?

If I'm wrong, advice steering me in the right direction, or a shot in
the head--- both would be appreciated :)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Installation of python on my workspace.

2006-07-05 Thread Lunpa

[EMAIL PROTECTED] wrote:
> Hi,
>
> I had two questions. I am new to Unix and Python. I wanted to get
> python installed on my unix terminal without too much interference from
> the administrator. How can I do this?
>
> It seems python is already installed at some location. But when i type
> Idle I am not able to get the Integrated Environment(IDLE). There is
> already the Tkinter.py installed . Do i have to modify my profile and
> add any environment variables to my .profile to get it going.
>
> I would greatly appreciate it, if anyone could help me with this.
> Thanks.

As far as I know, my linux instalation of python doesn't have an IDE,
but it could be different for your situation.  If it is, the command is
probably not called "idle" (that does something else normaly).

You can always use an existing text editor.  If python itself is
installed, you should be able to type "python" to bring up the
interperiter, or "python filename.py" to run filename.py.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter vs PyGTK

2006-04-13 Thread Lunpa
makes me wonder how useable pygui is now...

I made the mistake of using wxpython a while back... having something
that runs perfectly in windows, and *sorta* works in other platforms
hardly counts as cross platform, imho.  And they wonder why tkinter is
shipped with python while wxpython is not...

Personaly, I would just use Tkinter untill a new gui library comes
along that actualy works in platforms people use, not just the one the
dev prefers.  Setting up gtk in windows can be a daunting task for
some, though for projects that I know probably won't see the anyone
else's machine, I just use pygtk, for consistency with the rest of my
apps.

I guess this was slightly off topic, but I think its also important to
consider who might be using your apps when picking out a gui to use.

-- 
http://mail.python.org/mailman/listinfo/python-list