Re: [pygame] How to prevent mouse initialization in Pygame

2017-07-05 Thread Alec Bennett
Why not just programmatically move the mouse offscreen? 

Or change the mouse cursor to something invisible. Both are easy under wx 
python, im guessing easy with pygame too. 




> On Jul 5, 2017, at 4:22 PM, Greg Ewing  wrote:
> 
> Роман Мещеряков wrote:
>> I instruct pygame to not use X Window server (which, if I understand right, 
>> should set $DISPLAY environment variable), but to use framebuffer.
> 
> Probably the framebuffer device is owned by root and only allows
> access by root. Changing the permissions on /dev/fb might let
> you avoid the need to run as root.
> 
> -- 
> Greg
> 


Re: [pygame] How to prevent mouse initialization in Pygame

2017-07-05 Thread Greg Ewing

Роман Мещеряков wrote:


I instruct pygame to not use X Window 
server (which, if I understand right, should set $DISPLAY environment 
variable), but to use framebuffer.


Probably the framebuffer device is owned by root and only allows
access by root. Changing the permissions on /dev/fb might let
you avoid the need to run as root.

--
Greg



Re: [pygame] How to prevent mouse initialization in Pygame

2017-07-05 Thread Daniel Foerster
Yeah that's not going to work because the attempted imports just fail. If
you think having the mouse not initialized might help, change your call to
pygame.init() into calls like pygame.display.init().

On Jul 5, 2017 10:33, "Роман Мещеряков" 
wrote:

>
> среда, 5 июля 2017 г., 3:39:28 UTC+3 пользователь
> mic...@callthecomputerdoctor.com написал:
>>
>> I think I can answer this. When your keyboard and mouse are plugged
>> directly into a Linux box and you're sitting in front of the box using it
>> regularly, the system has already started the X Window server, which is a
>> root-level process, for you.
>>
>> When you log into the Linux box using ssh, you are given a text-only
>> container/shell to play in. The X Window server is attached to a different
>> login instance, not to you. So if you want to have access to the video
>> sub-system from an ssh shell, you need to get root permission.
>>
>> Alternatively, you could set up a VNC daemon server on the Pi to run when
>> your desktop loads, and then from a remote computer, you could log into the
>> Pi and control the desktop. I think that is more what you're looking for.
>>
>
> I’m not sure that X Window server is the cause, because I set up my
> Raspberry Pi to boot to command line. At least I see no desktop GUI after
> booting with keyboard connected, just command line login prompt. There is
> also second reason: I instruct pygame to not use X Window server (which, if
> I understand right, should set $DISPLAY environment variable), but to use
> framebuffer.
>
> But I think you are right in that ssh console and “real” console are
> different in some aspects which are important for pygame initialization.
>
> By the way, I examined __init__.py file of pygame (on my system it’s
> located in /usr/lib/python2.7/dist-packages/pygame/) and found out that
> it imports some modules with self-descriptive names like “key”, “mouse” and
> “joystick”. Moreover, comments and code in this file told me that these
> modules are not mandatory. So I renamed “mouse.so”, “key.so” and
> “joystick.so” in the aforementioned directory. My hope was that this will
> at least help me to get rid of mouse pointer in the top left corner of the
> screen or maybe even will let pygame initialize from ssh console without
> sudo. But, unfortunately, renaming didn’t change anything apart from
> several warnings printed on each pygame import:
>
>
>
> pyscopefb.py:2: RuntimeWarning: import joystick: No module named joystick
>
> (ImportError: No module named joystick)
>
>  import pygame
>
> pyscopefb.py:2: RuntimeWarning: import key: No module named key
>
> (ImportError: No module named key)
>
>  import pygame
>
> pyscopefb.py:2: RuntimeWarning: import mouse: No module named mouse
>
> (ImportError: No module named mouse)
>
>  import pygame
>


Re: [pygame] How to prevent mouse initialization in Pygame

2017-07-05 Thread Роман Мещеряков

среда, 5 июля 2017 г., 3:39:28 UTC+3 пользователь 
mic...@callthecomputerdoctor.com написал:
>
> I think I can answer this. When your keyboard and mouse are plugged 
> directly into a Linux box and you're sitting in front of the box using it 
> regularly, the system has already started the X Window server, which is a 
> root-level process, for you. 
>
> When you log into the Linux box using ssh, you are given a text-only 
> container/shell to play in. The X Window server is attached to a different 
> login instance, not to you. So if you want to have access to the video 
> sub-system from an ssh shell, you need to get root permission.
>
> Alternatively, you could set up a VNC daemon server on the Pi to run when 
> your desktop loads, and then from a remote computer, you could log into the 
> Pi and control the desktop. I think that is more what you're looking for.
>

I’m not sure that X Window server is the cause, because I set up my 
Raspberry Pi to boot to command line. At least I see no desktop GUI after 
booting with keyboard connected, just command line login prompt. There is 
also second reason: I instruct pygame to not use X Window server (which, if 
I understand right, should set $DISPLAY environment variable), but to use 
framebuffer. 

But I think you are right in that ssh console and “real” console are 
different in some aspects which are important for pygame initialization. 

By the way, I examined __init__.py file of pygame (on my system it’s 
located in /usr/lib/python2.7/dist-packages/pygame/) and found out that it 
imports some modules with self-descriptive names like “key”, “mouse” and 
“joystick”. Moreover, comments and code in this file told me that these 
modules are not mandatory. So I renamed “mouse.so”, “key.so” and 
“joystick.so” in the aforementioned directory. My hope was that this will 
at least help me to get rid of mouse pointer in the top left corner of the 
screen or maybe even will let pygame initialize from ssh console without 
sudo. But, unfortunately, renaming didn’t change anything apart from 
several warnings printed on each pygame import:

 

pyscopefb.py:2: RuntimeWarning: import joystick: No module named joystick

(ImportError: No module named joystick)

 import pygame

pyscopefb.py:2: RuntimeWarning: import key: No module named key

(ImportError: No module named key)

 import pygame

pyscopefb.py:2: RuntimeWarning: import mouse: No module named mouse

(ImportError: No module named mouse)

 import pygame