I wrote a python GUI in Tkinter for a time-clock system. The micro machine is wall mounted and the employees only have access to the touchscreen menu I programmed and a barcode swipe. I know how to get the script to start on startup, but how do I prevent them from exiting out or opening other menus? Basically the sole purpose of this console is to run the time-clock GUI.
If it cant be done in Ubuntu, is there another flavor of linux it can be done in?
There is also de KDE Kiosk project, which you can install on a ubuntu machinne:
"
The KDE Kiosk is a framework that has been built into KDE since version 3. It allows administrators to create a controlled environment for their users by customizing and locking almost any aspect of the desktop which includes the benign such as setting and fixing the background wallpaper, the functional such as disabling user log outs and access to the print system and the more security conscientious such as disabling access to a command shell."
http://techbase.kde.org/KDE_System_Administration/Kiosk/Introduction
You can use wm_overrideredirect, then make the UI full screen. This will remove all window decorations so there's no way to close the window. If that's not enough, as a final step you can do a global grab. With that, you effectively control everything that they can do.
Be very careful about coding global grabs -- make sure you can ssh into that box to kill the process, otherwise you can effectively denial-of-service your box.
Don't start a window manager. Only start your program, e.g. from xinitrc. Make the program full-screen
Related
I made a python script that runs a graphical automation using pyautogui (mouse movements) over a huge number of PDFs.
The automation appears to need an active display, for the mouse movements and the PDF to be opened.
If I connect to the Azure VM (with Windows OS) with SSH and start the python script, I get an error from pyautogui as below:
pyautogui.FailSafeException:
PyAutoGUI fail-safe triggered from mouse moving to a corner of the screen.
To disable this fail-safe, set pyautogui.FAILSAFE to False.
DISABLING FAIL-SAFE IS NOT RECOMMENDED.
I have tried with the failsafe disable and still it doesn't work.
As I have read, this happens because there is no active display opened.
If I connect to the VM using RDP, the automation starts and works as expect until I minimize or close the window. When I do that I get the same failsafe error from pyautogui.
But I cannot keep the window open, because I would need to start the same automation on 16 more VMs.
Is there a way to run such graphical automations in Azure VMs or any other similar solution? Docker maybe?
Is there any solution to run or host VM machines with permanent active display opened? Is something like this possible?
I ended up using Virtual Box.
I first created one VM with the needed software and files.
You can start the VM in headless mode. Then show the VM in order to log in to Windows and start the automation script. Then you can close the VM window and let it run in the background. The graphical automation will still run ok in that case. PyAutoGUI won't crash as if there were no active display.
I cloned the original VM 16 times and split the work evenly between the VMs.
Using ssh I am able to connect to each VM and monitor the status of the automations.
It would be great if there were a solution similar to kubernetes that could help with the deployment of such automations and with the monitoring of the status, but until then this is ok.
I have a few personal helper applications written in Python that communicate with me either through the Windows 10 taskbar area on the right (where the icons are - mine below is the red and blue square), or the Windows 10 Notification Center.
They currently run in a minimized shortcut (that points to python.exe) and I would like to remove them from the taskbar
The solution I am looking at is to run them as services. I created one (through nssm) and started the service that runs my program (via the Local Service account, which allows me to (hopefully) interact with the desktop). Unfortunately, I get
I allowed MY-COMPUTER-NAME$ to access the working directory of the code, as well as to the script itself.
Is there something else I should allow for the script to successfully run?
(Note: the service started when I used my account, but the taskbar icon started from my program did not show up)
I once used this command in cmd to run a service that is designed in python. follow this
sc create WojAPP binPath= "C:\Python34\Python.exe -- C:\tmp\yourpythonscript.py"
[reference]When creating a service with sc.exe how to pass in context parameters?
I have been facing issue with automation execution of my script on one of the VM. I have automated the functionality of Saving a Document which is ideally a Windows Designed UI. I have tried using various technologies/tools like AutoIT, Python, Sikuli but the script halts if VM is minimized. It works perfectly fine is VM is open via RDP and I can see runtime execution. But If I minimize the RDP, the script halts at 'Save As' dialog box, none of the send keys (Cntrl+s) or (Enter) work via AutoIt script. Please help with some solution so as to have successfully execution of script even in minimized mode.
The reason why your script fails when it gets executed over a minimized RDP session is quite simple. GUI automation/testing tools need to have an unlocked, active desktop - otherwise the operation system thinks that it doesn't need to actually render GUI operations (which is time consuming) since there no user can that can see the rendered graphical user interface anyway. And programs don't communicate via GUIs normally ...
This is why QF-Test and other GUI automation/testing tools often have a note in their FAQs describing this kind of problem. For example FAQ 14 in the case of QF-Test, see https://www.qfs.de/qf-test-handbuch/lc/manual-en-faq.html
As described in the FAQ 14 on Windows 10 or Windows Server 2016 and in case of an RDP connection you need to modify the Registry. Go to
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client
and add a new value
RemoteDesktop_SuppressWhenMinimized as DWORD having the value 2
After restarting you will then be able to minimize the RDP connections. However disconnecing or closing the RDP connection will probably still result in a failure.
You could try running tscon.exe RDP-Tcp#0 /dest:console as admin as mentioned here. This will disconnect your RDP connection but should leave all GUI programs running normally on the VM. I have personally used this with autoit on a VM and it worked OK. Of course you will not be able to monitor your script as it runs so this may or may not work for you.
I am anticipating the answer to be no, but I wanted to verify. If I write a Python program that was a GUI, can I launch that from a Linux CLI and still get the GUI? I am trying to build an embedded Linux system and I want to exclude everything that isn't necessary. This is a kiosk-like device, so all I need is my Python GUI.
Various widget toolkits (GTK+, Qt, etc.) can run on DirectFB instead of X11, which will allow you to have a GUI running on the Linux framebuffer device instead of requiring a full X server.
To run GUI anything on Linux you'll need an X server at a minimum.
There are curses based sorta-GUI libraries that assume an 80x24 character terminal emulator if you want to go that route, but you'll still need some kind of display.
I am creating Windows service class in Python that will eventually display a Window when certain conditions are met. Since (as I understand it) services cannot have GUIs, I'm trying to start up a GUI in a seperate process (using subprocess.Popen) when the conditions are right. This isn't working, presumably because the child process has the same privileges as the service.
So how do I start a process from a Python Windows Service that has the ability to display GUIs on the screen?
If you give your Service the Allow service to interact with desktop permission it will be able to create windows without the need to launch a subprocess.
As mentioned in this answer, you may have to (eventually) transition to a client-server model since Windows Vista and later no longer support direct interaction with users.