Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PyGTK-2 Full-Screen mode.

147 views
Skip to first unread message

kkennedy

unread,
Mar 2, 2003, 3:58:00 PM3/2/03
to
Does anyone know how to make a window "full-screen" with PyGTK-2? By
full-screen, I mean no decoration and no task bar or panel visible,
and preferably the ability to disable the alt-tab functionality. This
would be the eqivalent of the "full-screen-exclusive-mode" in Java SDK
1.4.

Here is my problem: I am writing a simple childrens game (in Python),
and I would like them to be able to play it when I'm not around. The
problem is that they can really mess up icons, menus, and whatever
else can be randomly clicked on. I am using Redhat 8.0. If anyone
knows another (better) way of solving this problem, your comments are
welcome.

Thanks.

Fernando Perez

unread,
Mar 2, 2003, 4:29:15 PM3/2/03
to
kkennedy wrote:

> Here is my problem: I am writing a simple childrens game (in Python),
> and I would like them to be able to play it when I'm not around. The
> problem is that they can really mess up icons, menus, and whatever
> else can be randomly clicked on. I am using Redhat 8.0. If anyone
> knows another (better) way of solving this problem, your comments are
> welcome.
>

You might want to try giving them an account which uses KDE for the desktop
in 'kiosk' mode. This is a restricted mode where users can make no changes
to the desktop, meant for kiosk-type computers in public areas. Even if
you develop the game using pygtk, this kind of account for kids might be
useful.

Cheers,

f.

Panayotis Prokopiou

unread,
Mar 2, 2003, 5:06:55 PM3/2/03
to
oups :-) i'm terribly sorry. I've just messed it up.

Gerrit Holl

unread,
Mar 2, 2003, 4:58:02 PM3/2/03
to
kkennedy schreef op zondag 2 maart om 22:02:01 +0000:

Pygame (pygame.org) has a fullscreen mode, and IIRC it can be used
with WxPython. You can grab all control (except for ctrl-alt-backspace).
Just FYI.

yours,
Gerrit.

--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/

kkennedy

unread,
Mar 2, 2003, 10:50:28 PM3/2/03
to
Gerrit Holl <ger...@nl.linux.org> wrote in message news:<mailman.1046642224...@python.org>...

> kkennedy schreef op zondag 2 maart om 22:02:01 +0000:
> > Does anyone know how to make a window "full-screen" with PyGTK-2? By
> > full-screen, I mean no decoration and no task bar or panel visible,
> > and preferably the ability to disable the alt-tab functionality. This
> > would be the eqivalent of the "full-screen-exclusive-mode" in Java SDK
> > 1.4.
> >
> > Here is my problem: I am writing a simple childrens game (in Python),
> > and I would like them to be able to play it when I'm not around. The
> > problem is that they can really mess up icons, menus, and whatever
> > else can be randomly clicked on. I am using Redhat 8.0. If anyone
> > knows another (better) way of solving this problem, your comments are
> > welcome.
>
> Pygame (pygame.org) has a fullscreen mode, and IIRC it can be used
> with WxPython. You can grab all control (except for ctrl-alt-backspace).
> Just FYI.
>
> yours,
> Gerrit.


Hey, thanks for the link. I'll definately check it out. I'm
relatively new to Python programming, and somewhat new to Linux (1.5
years). The last time I tried installing wxPython on Linux, I was
unsuccessful. But, it's been a while, and I've learned a lot since
then so I may give it a whirl.

David M. Cook

unread,
Mar 3, 2003, 1:50:51 AM3/3/03
to
In article <14bd1399.03030...@posting.google.com>, kkennedy wrote:

> Does anyone know how to make a window "full-screen" with PyGTK-2? By
> full-screen, I mean no decoration and no task bar or panel visible,
> and preferably the ability to disable the alt-tab functionality. This
> would be the eqivalent of the "full-screen-exclusive-mode" in Java SDK
> 1.4.

I think this might do it:

window1.set_decorated(gtk.FALSE)
window1.fullscreen()

You'll need to do a bit more to disable alt-tab.

See the API docs for more info:

http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html

Dave Cook

kkennedy

unread,
Mar 3, 2003, 1:47:50 PM3/3/03
to
"David M. Cook" <dave...@nowhere.net> wrote in message news:<fXC8a.151572$zL6....@news2.central.cox.net>...


This will be perfect, if it works! I will try it tonight and let you
know how it goes. Thanks a lot for the link to some possible
documentation.

Question: How in the world did you interpret those two method calls
from the documentation? In the documentation the method names are
different and they both require that the GtkWindow be passed as the
first argument. However, what you have written in Python are
different method names and the exclusion of the GtkWindow argument.
How did you come up with this?

David M. Cook

unread,
Mar 4, 2003, 3:33:02 AM3/4/03
to

Better docs specifically for the Python API are being worked on.

Until then here are some rules for translating from C to Python:

Namespaces:

o gtk_ -> gtk.

o gnome_ -> gnome. or gnome.ui. (depending on header file)

o g_ -> gobject.

o gdk_ -> gtk.gdk.

Class names are in "StudlyCaps" (same as the C typenames without the "Gtk"
part):

o gtk_class_name_new() -> gtk.ClassName() e.g. gtk.TreeView()

o gtk_class_name_new_with_foo(myfoo) -> gtk.ClassName(myfoo)
e.g. gtk.TreeView(model)

Method names are generally the same as C method names.

gtk_class_name_method_name(instance, params)
-> instance.method_name(params)

e.g. gtk_tree_view_get_column(treeview, 4) -> treeview.get_column(4)

In general, in/out parameters become return values. Usually in cases where a
"failure" would be returned, None is returned.

gtk_class_name_method_name(instance, a, b, &c, &d)
-> c, d = instance.method_name(a, b)

e.g.

gtk_tree_view_get_path_at_pos(treeview, x, y, &path, &column, &cell_x,
&cell_y)
-> path, column, cell_x, cell_y = treeview.get_path_at_pos(x, y)

Constants, e.g.:

GTK_WINDOW_TOPLEVEL -> gtk.WINDOW_TOPLEVEL
GDK_KEY_PRESS -> gtk.gdk.KEY_PRESS
FALSE, TRUE -> gtk.FALSE, gtk.TRUE

Others:

o instance.connect() instead of signal_connect()

o paths in TreeView/Models are just tuples.

o string lengths do not need to be specified

o The TreeViewColumn constructor can take named parameters for the
CellRenderer properties:

cell = gtk.CellRendererText()
column = gtk.TreeViewColumn(colname, cell, text=i, editable=j)


Dave Cook

0 new messages