Creating kiosk app with web browser extension - python

I would like to create a kiosk application that wraps a web browser and enables extensions.
This application needs to be launched at startup of windows 10 pro. It has to display a web page and an extension that hide html elements like buttons and links.
I have tried to develop a little application with python and selenium. It actually works but the application start too slow and shows the desktop. I tried some startup application mechanism on Windows but none of them can launch the application fast enough to hide the desktop.
Now I am following the uwp way. It solves all the problems about the kiosk implementation but with WebView2 I think I cant use extensions. I was thinking about injecting javascript code on the fly but I dont now how to do it or if it is possible.

You can use WebView2's ExecuteScriptAsync(string) method to run JavaScript.

Related

Is there any way to integrate an OS native window in a browser dialog?

I'm building a prototype for a bin packing app.
The front-end runs on the browser. Where it takes a picture and sends it to the back-end to extract the "board outline" from the image and then responds to front-end with a svg of it.
To finally add some shapes and pack in the bin.
I'm working with rust both back-end and front-end through wasm.
The back-end is polyglot, I use rust-ffi to encrust some java and pyhton code. I'm reciclyng the bin packing algorithm from a java code. And the image conversion is being done by the owners of the project with python.
The point is that the whole front-end runs in the browser and these guys at some point in their process need the user to click on the image and for that they display a dialog with the native windows of the operating system.
Initially this prototype will not be deployed in a network, but everything will be deployed on the same host as the client, so ultimately it will not be a catastrophic problem.
The question is that it totally impairs the usability of the project so I want to know if it is possible to somehow integrate the popup window of the python process in a browser dialog?
Note:
The python program was made with opencv

(Updated)How to force a browser window to seems like a desktop app window?

Dears,
I'm using Electron and Python to deploy desktop apps. However, I'm wondering if I can exclude the Electron part of this project. I want just put some settings in a js file or something like that to imitate the appearance of a desktop window. In this approach, my user will just need Firefox or Chrome installed to use the app (and the python core that I'm shipping). Does anyone know how to do that?

How to control a Windows application from Python

I have the application installed on my windows PC, I want to launch that application using python and select dropdown options and do some other activities in that application.
I was able to launch the application using the os.system command, but I am not able to proceed further.
I want my program to do things like:
* select from a dropdown menu
* click on a button
How can my application control the user interface of another application?
Normally, an application exposes a user interface (UI) for users, and an application programming interface (API) for programming.
A human being uses keyboard and mouse to work with the user interface (UI)
An application uses programming to work with the application programming interface (API)
The UI is designed for humans, and the API is designed for computers.
It is sometimes possible to use programming to control the user interface of another program -- so your program acts as if it were using the keyboard and mouse. This technique is often called "UI automation", and programs that do it are sometimes called "robots".
It's a big topic, and it can be quite complex. It's almost always better to use an API instead if you can: it's faster, simpler, more reliable.
If you do need to use UI automation, there are a few different tools that can help.
You are asking about Python, so here are a few UI automation tools that work with Python:
AutoIT is a standalone product, but you can use Python to script it.
PyWinAuto is designed for use from Python.
Sikuli uses computer vision to find parts of the screen. I believe it comes with a recording tool as well.
Just to repeat: UI automation is weird and hard. If you can possibly use an API instead, your life will be much easier.
You need to install pywinauto package
Try the following code to run the .exe file
from pywinauto import application
app = application.Application()
app.start("Notepad.exe")
here you are:
(with os ^_-)
import os
os.startfile('your exe file address')

How to load SWF content into a Python application on Linux?

I have an application that uses Flash for the GUI and Python for the core logic. This combination is awesome. Unfortunately my current approach only works on Windows, as it uses the wxPython comtypes library to embed the Flash ActiveX player. Every other aspect of the app is platform-agnostic, so I'm thinking there must be some way on Linux to have Python talk to Flash.
The SWF need not require AVM2/AS3, though ideally I could use the most current Flash player available. I am using wxPython (wxWidgets) and would prefer to keep using it. Worst case I could jerry-rig something that loads the SWF in a separate process and talks over a socket connection to the Python, but I see no simple way to have the Flash display inside my application's window rather than a player window with its own menus and decorations.
Any suggestions appreciated. I'm very open to hacking at a solution if there's reason to believe it will work :)
Flash Professional has support to Adobe Air, so you could use it as front-end, usually a flash project can be released as an AIR application without major changes to its code. The communication could be done using Native Process Api (see links bellow). Then you can run it on Mac, Win e Lin.
http://www.kirupa.com/forum/showthread.php?349728-Air2-NativeProcess-launching-Python-scripts.
http://mykola.bilokonsky.net/2010/11/adobe-air-nativeprocess-and-python-introduction/

How can I use HTML + Javascript to build a python GUI? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last month.
Improve this question
I have been experimenting with Appcelerator Titanum yesterday and I think it's cool when it comes to Javascript.
Python features on Appcelerator Titanum are so limited (can't use some modules for example).
My question is How can I use html & javascript as a GUI tool for a real python application ?
I am running windows 7 and i was thinking of using webkit for that purpose but couldn't know how to work with it in python.
I am planning to make a standalone executable using py2exe as I don't know if the users always have python and the appropriate modules installed.
If you're after webkit bindings for Python, look at PyQt, which includes Webkit, as well as wxWebkit (http://wxwebkit.wxcommunity.com/) if you're using wxWidgets. This lets you embed webkit in a Qt or Wxwidgets app so that you won't have to go through a browser.
If you do use this, then you can either use a web server in Python, like others have mentioned, or you can control the Webkit control directly (though I'm not sure how practical this is).
Beyond that, there's also Pyjamas Desktop (http://pyjs.org/), which lets you use Pyjamas to build the application, then run it.
pywebkitgtk might be what you are looking for.
"HOWTO Create Python GUIs using HTML" http://www.aclevername.com/articles/python-webgui/
http://arstechnica.com/open-source/guides/2009/07/how-to-build-a-desktop-wysiwyg-editor-with-webkit-and-html-5.ars
But I'm not sure if it runs on Windows.
PyQt and Webkit would work on Windows.
http://www.rkblog.rk.edu.pl/w/p/webkit-pyqt-rendering-web-pages/
Here is a nice PyCon talk on the subject.
So how can I use html & javascript as a gui tool for a real python application ?
You run a web server on your desktop. For example, this: http://docs.python.org/library/simplehttpserver.html In a few lines of code you can provide a complete HTTP server that will serve your HTML and Javascript to a browser.
I am running windows 7 and i was thinking of using webkit for that purpose but couldn't know how to work with it in python actually moreover I wanna use py2exe so how can I use python + webkit to handle the gui part ?
Hard to parse that. It either indicates too much coffee or no familiarity with punctuation.
Randomly, I'll pick the following words as possibly being meaningful.
how can I use python + webkit to handle the gui part ?
You run a web server on your desktop. The web server provides html and javascript pages to a browser -- also running on your desktop.
Have you looked at htmlayout? http://terrainformatica.com/htmlayout/main.whtm
PHP Desktop is an open source project founded by Czarek Tomczak in
2012 to provide a way for developing native desktop GUI applications
using web technologies such as PHP, HTML5, JavaScript & SQLite. The
development workflow you are used to while creating web applications
remains the same. The step of turning an existing website into a
desktop application is basically a matter of copying it to the "www/"
directory.
PHP Desktop also releases Python Desktop and Ruby Desktop. It allows you to create a Windows app, that either uses the installed IE for the front-end, or uses an instance of Chrome (so definitely HTML5 support too) that is packaged with the app. It starts a local webserver, supports many databases with a PDO driver and you can layout the views in HTML and Javascript. You can download external resources like any other website/webapp, so it supports network related stuff too. The app ships with its own bare-bones version of Python, you can add libraries as desired.
I looked at all the answers before, as I had the exact same question as you, but PHP Desktop easily solved it for me.
https://code.google.com/p/phpdesktop/wiki/EmbeddingOtherScriptingLanguages
I assume you are mobilizing a web-application for cross platform access.
If so have you considered abstracting the cross platform access at the web-app presentation layer ?
Appcelerator / Webkit does not provide true native look-and-feel on mobile devices but this is where a new technology can help.
If you are thinking about real desktop applications that are multi-threaded and/or use multiple system component - forget about JavaScript. That requires a very good SDK (like PyQt4), and not a basic wrapper like Appcelerator Titanium. Note that developing such applications takes a lot of time.
Second option is to drop the desktop binding and make a web application with an advanced frontend UI made with one of JavaScript frameworks & friends (Ember, Angular... up to things like dhtmlx and alike widgets). Those can't use system components (like access some hardware), but they can provide nice services.
Take a look at pySide
I suggest using QtWebKit
And you can use PyInstaller if you want to hide the source code.
You can use TideSDK that can help you creating beautiful and unique desktop apps using your web development skills (HTML5 / CSS3 / JavaScript / Python or PHP or Ruby).
Website: http://www.tidesdk.org
Using Python in TideSDK: http://tidesdk.multipart.net/docs/user-dev/generated/#!/guide/using_python
Hope that helps! :)

Categories