[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] root privileges when running pygame



ahhhh I see
you didn't call pygame.init()!
try this


import pygame
from pygame.locals  import *
from time import sleep
pygame.init()
d=pygame.display.set_mode((500,500))
d.fill((255,255,0),(0,0,500,500)
time_to_exit = 0
while not time_to_exit:
    for e in pygame.event.get():
        if e.type == KEYDOWN:
            if e.key == 27: #an escape
                time_to_exit = 1
    pygame.display.update()


also 500x500 is an odd resolution, if it's going to be fullscreen you
might want to use a 16/12 resolution like 640x480 or something...
to make it fullscreen the line would be 
d = pygame.display.set_mode((640,480),FULLSCREEN)
I believe.
also the "fill" command I believe needs to have a rect argument of what to fill
it fills an area not the entire surface (unless the rect covers the
whole surface)
again this is all theoretical because I have to leave and don't have
time to test it.
good luck,
-Luke



On 6/9/05, Tobias Pfeiffer <BoteDesSchattens@xxxxxx> wrote:
> Hi!
> 
> Darrell Stitt wrote:
> > I'm attempting to run pygame but it says:
> > pygame.error: Unable to open a console terminal
> 
> Hm... why 'console terminal'?
> 
> > when I run this I expect to see a yellow window. What I get is a
> > fullscreen with yellow only if I run this sudo or as root.
> 
> You really mean 'fullscreen'?? Or only 'completely filled window'?
> 
> > This is on my linux ppc. Using XP I get a yellow window.
> 
> Usually, it's the other way around, because only the user who has
> started the X session is allowed to create windows in it, then not even
> root is allowed to. Is your X session running as root??
> What I observed, when I try to run your script as root under the
> user-owned X session, the monitor flickers (just like when changing
> resolution) and I get the following:
> 
> > Xlib: connection to ":0.0" refused by server
> > Xlib: No protocol specified
> >
> > Xlib: connection to ":0.0" refused by server
> > Xlib: No protocol specified
> >
> > Traceback (most recent call last):
> >   File "test.py", line 4, in ?
> >     d=pygame.display.set_mode((500,500))
> > pygame.error: No video mode large enough for 500x500
> 
> Maybe these problems are related / the same.
> 
> Bye
> Tobias
> 
> --
> Debian GNU/Linux Sarge has been released as stable!
>   -- http://www.debian.de/News/2005/20050606
> 
> 
>