Page 1 of 1
Startx python script - no mouse [SOLVED]
Posted: Thu Feb 04, 2016 11:27 am
by mikorians
I'm a noob.
Using RPI B+, Wheezy.
No normal problems with mouse.
I can start LDE with startx, no mouse or other problems. I have my pi configured to start at command line prompt.
I'm trying to conserve resources by only having 1 window application.
So...
I type: startx /....python /.....myapp.py
(Exact default paths - I forget)
And I am presented with my program. Yay. there's a white borderline around the edge of the screen.
But no pointer, no function (tried blindly, clicking around). I have no key bindings yet, so keyboard unknown.
It runs just fine if I just type startx and then click up python and run my script. But I don't think I need the whole GUI, do I?
So there must be a startx flag or a script thingy I need to know?
Can anyone assist me?
Re: Startx python script - no mouse
Posted: Mon Feb 08, 2016 12:25 pm
by -rst-
That should work. What UI library are you using in your Python program (PyGame, tkinter, something else)?
Re: Startx python script - no mouse
Posted: Mon Feb 08, 2016 10:44 pm
by mikorians
Just plain tkinter and python 2.
My program doesn't make any direct mouse references yet, just creates widgets and the window.
I can't understand why no mouse at all. I should add a key binding so I can quit, but I think ctrl-c got me out... And also ctrl-alt-f1 (new command line)
Re: Startx python script - no mouse
Posted: Tue Feb 09, 2016 1:33 pm
by -rst-
No experience myself but I have read people running for example Chromium browser in 'kiosk mode' as the only X application. Maybe tkinter does not play well with the window manager (that should provide the mouse as far as I understand).
Re: Startx python script - no mouse
Posted: Mon Feb 29, 2016 6:16 pm
by hihiuztrewq
Hey, did you find a solution?
Re: Startx python script - no mouse
Posted: Tue Mar 01, 2016 5:06 am
by mikorians
Nope.
But I can only say it's a standard tkinter window with a canvas.
I'd originally installed Raspian with the GUI on, I wanted to reduce overhead so I somehow (with help I'd read here) got the automatic startx turned off and set it to autolog me in and drop to the prompt successfully. It puts a delay and a notice in my boot, but works. I noted a white line at the edge of the screen when I invoke my python script, if any of this helps.
Re: Startx python script - no mouse [SOLVED]
Posted: Sat Mar 05, 2016 7:31 pm
by mikorians
Hey! Presto! I got lucky!
1. I plugged in another mouse. Invisible mouse clicks started working!
2. I read about making the pointer invisible in python.
Wound up with the answer by permutation and recombination.
Turns out tkinter lets you make your mouse invisible on a PER WIDGET basis. I had a whole window canvas - triple trouble!
Under my window init code I had to use:
self.master.config(cursor = 'none')
self.master.show = False
self.master.update_idletasks()
self.master.config(cursor = '')
self.master.show = True
self.master.update_idletasks()
Then, under my widget creator for my canvas I put:
self.canvas.config(cursor = '')
AND there was a big X pointer!
I hope this odd bit of research helps the whole community!
Re: Startx python script - no mouse [SOLVED]
Posted: Sat Mar 05, 2016 7:35 pm
by mikorians
OH YEAH,
I'd also done this:
cd /usr/share/icons
mv Adwaita Adwaita_mine
And the ugly white line at the edge of the screen?
Under my tkinter window creation:
self.place(x=-1, y=0, width=641, height=400)
self.createWidgets()... Etc.