interacting with a user created gui dynamically using python - python

There is a user created GUI which is an .exe that loads a DLL. This GUI has a bunch of sliders, check boxes etc. I would like to move two sliders at the same time using python automatically without me using my mouse to move the sliders. I would like to know the python modules that an be used to achieve this purpose.

You can try using SikuliX.
It can be used to automate mouse or keyboard actions based on pattern matching. It is originally developed for Java I think, but it can be used with Python.
Basically, anything you can do yourself manually can be done with it.
The developer seems to be pretty active, so you can easily seek help from him if you have issues.

Related

Access variables from Go in Python and vise versa

My engine is written in GO and I already use SQLITE because I generate some plots that I want to display in a GUI. So far, I think that GO does not have a mature GUI package, so I am building my GUI in Python, with Tkinter that I am familiar with.
When I run my engine in GO with a certain flag, it calls the Python script for the GUI and it generates the content on the background continuously. There are certain modes that the GO engine runs and normally I have to change them by going back to the terminal that runs GO (different plots etc).
What I want, is to create action buttons in my Python GUI that they will change those flags/variables values and the GO script will generate different plots for example, without me going back to the terminal that runs the GO engine and manually do it.
So far, the only implementation from my side, was to create another SQLITE database and save my settings there. Then, when I press an action button at my GUI, it changes the value at my Settings Database and GO reads this value from there all the time, instead of waiting me to input it.
Is there any better way of doing it, passing a variable value(flag etc) from one programming language to the other(Python-GO) without using a database?
The variables that I am changing from the GUI are strings in general and I am asking this question because I think that it is a waste of resources to do it the way I do it.

Drag and Drop Files into Folders via Python GUI?

Problem
I'm trying to make a gui in python that displays two directories in two side-by-side panels and their contents (via tree, thumbnails, list, etc), which then allows the user to either:
drag files between both panels
select files to transfer (manually and via script), and transfer after user input
The point is to automate as much of the process as possible, but allow the user to verify each file's final transfer.
Is this possible? Which python gui library would be ideal for this? I'm just looking for a general direction, since I really don't know where to begin looking.
Current workaround
I have a python script that will sort mail into subfolders based on client, and then iterates through each client, simultaneously opening mail\<client> and the client's main file directory in explorer. I drag each file to its appropriate <main>\<client\<subfolder>, close the two windows, press 'enter' in IDLE, and it moves on to the next client. Tedious, but it's a rough implementation.
System info
Windows XP, Python 2.7
Well, you could implement a custom drag-and-drop with any GUI framework, so you might consider using Tkinter, since it's built-in to the standard Python library.
If you need to be able to drag-and-drop between applications, it's a bit more complicated, but supposedly can be achieved with Tkinter, although you might prefer to use wxPython, for which there's an example on the wiki.
For anything file related I would use the Python os module, http://docs.python.org/2/library/os.html

Python Script (main) + Blender "face" animation

SO I am infact doing something very similar to this user posts:
https://stackoverflow.com/questions/6800292/python-ai-and-3d-animation
but it has no answers and I couldn't contact the user.
Basically I have a functioning python script that answers me with an action accordingly to my voice command. (Fetch emails, weather forecast, turn lights ON/OFF, etc), it has been made using the pyspeech library which is pretty darn good.
Now I want to give my programm a "face"! I thought about modelling the face with Blender (have some knowledge and would build up on it) and I know I could animate it, so the lips move and such.
So I want to know if it is at all possible to:
Load the "face" that I made from blender from my main python script (so when my programm start the face would be there on the screen too)
Run from the script the animations such that when for example when my programm says "You're welcome" I would run the animation that the lips move on the face to simulate it is speaking.
I know that blender has a good python integration (maybe correct is to say it is built on?) and that is why I thought it would be a good program to use.
Hope someone can help and tell me if that is at all possible and maybe show me some right way to go, my googling just showed me always python scripting with Blender which is not what I exactly need here... I think...
Cheers,
Flavio
Indeed, what you want is possible.
If all you want is to play pre-rendered animation videos based on decisions on your program, any GUI that allows you to embedd and play video in a widget will do for your application.
You could rool out your own GUI using Pygame (which has video support, but you will need one of the "minor" more or less "amateur" widget toolkits made for pygame to make up the remaining of your application, as pygame is pretty low level.
On a higher level, although I'had not embedded video, I think you could go with PyQT4 (googled a bit, not that many examples either, buthints that there are eamples in QT4 source) or GTK+ (the samething, it looks like there are more examples).
Another option would be to build your application to run inside the Blener Game Engine itself - It offers both a high level Toolkit, and ways to customize behaviors to user actions (even without coding).
The major drawback in doing this is: I don't know which are the options to distribute an application that needs Blender Game Engine nowadays - your users will need to install Blender (but it is likely Blender folks made an easy way to jhandle this).
On the upper hand: you get the most flexibility, it would even be possible to render some sequences in realtime (as opposed to pre-rendered videos) in your app.
One thing: Blender nowadays use Python 3.x - if the other libraries you need are Python 2, you willl need to make one different process for the GUI inside Blender, and exchange data with your application's backeend in Python 2 (for example using jsonrpc or xmlrpc - that is enoguh simple in Python).

Python interactive CLI application?

I'm not even sure what these would be called? I used to write them in ADA running on VAX-VMS!
I want to make a simple menu-driven application that would let me display menus and use the cursor keys to navigate around them, choose items and navigate around the app. All fully old school text based.
I want to be able to take over the whole terminal window and display stuff in different places.
Is this possible in Python?
Check out the Python HOWTO on Curses Programming with Python and here is the library reference.
Another easy to use library is Urwid - Console User Interface Library.
http://excess.org/urwid/
http://excess.org/urwid/examples.html
Yes, have a look at the different curses implementations.

Detect Areas of Text in Screenshot

I'm working on a project to increase the ability for wine to automatically test software packages. What I'm looking to do now is detect text in the screen capture of the current window. I can then parse all of the text and use autohotkey to give a mouse click on the coordinates of the text I want.
For example, in firefox, I might want to test different things, the first open being opening preferences. I would then need to parse the screenshot of firefox, detect all of the separate locations of text. I can then run these separate images of text into tesseract-ocr and detect which one, says "Edit". I then redo this again for "preferences".
I've tried to find a solution but so far can't find anything. I'd prefer a solution that uses python or has python binds as thats what I've been programing in so far.
A possible starting point is Project SIKULI. It is a tool to automate GUI testing. It is written in Java, nonetheless it includes a scripting environment based on Jython, hence modifying it to support python script may be not too difficult.

Categories

Resources