In raspberry pi using Python is there any way to make a program where according to the place you click on a designed screen actions can be taken and output given accordingly.
I am using the raspbian-jessie os and have a 7 inch touch screen, I want to create buttons on the screen. When I click on a button it should execute a program.
you probably put the wrong tag, there is nothing to do with functional-programming or graphics, and still little relations with whether you are in raspberry pi or something else
you mean you are in linux and got a touch screen, and want to add some indicator on your touch? what desktop are your using, or something to do with the hardware.?
please state your question clear! and don't let me guess your expection
Look into Kivy or Qt. These are the most popular GUI interfaces for Python.
Related
I'm in a dilemma. I've got a python code that works for each of the yellow squares shown below but I want to make an application that looks like below and uses the information from the first text box and the second drag and drop box. Then depending on what the user clicked on, the code for that would run. I'm not sure how to approach this. Any help would be greatly appreciated!
You can use Python GUI libraries like:
Tkinter
PyQT
WxPython
Kivy
Pyglet
(This list is not exhaustive.)
Each has their own advantages and disadvantages. Choose the one that fits your project the best.
My personal recommendation for your particular project would be Kivy.
I am currently working on the final year project for my degree. I have chosen to research and develop a tool to aid the delivery of the new Computing curriculum that is coming to schools next year.
I am using a Raspberry Pi in my development, and I aim to teach extremely basic Python programming to children between the ages of 8 and 10. They are going to be able to control some hardware attached to the Pi using a simple API that I am going to create.
My question is: I would like to be able to create a GUI for the children to work in, which would allow them to write and compile scripts. This is mainly to get away from the unfamiliar interface of Linux and terminals etc, and put them in a friendly, basic interface which will pretty much just allow them to write their code and click a big red button to compile and run it to interact with the hardware. Is it possible to allow for text to be written in a GUI and then compiled when the button is pressed?
I am pretty new to Python myself so I am not as clued up as I'd like to be about the specifics of it. I know that it is possible to have the output of IDLE inside of a tkinter interface, and that it is possible to have text boxes for user input and stuff, but would it actually be possible to compile a script on button press and then run it? I have been thinking that maybe threading is the answer. Perhaps I could create a new thread to do it when the button is pressed?
My apologies if this is incredibly basic, but I am having no luck finding any answers about how I would do this. I think it's mainly because I am unsure on what exactly to ask for.
I appreciate any feedback/help, thank you very much.
Dell
Have your GUi write the Python code to a file, then dynamically import using the imp module. I actually do something similar :-)
import imp
hest = imp.load_source("Name", Path)
I'm trying to write a program than will detect when my mouse pointer will change icon and automatically send out a mouse click. Is there a better way to do this than to take screenshots and parse the image for the mouse icon?
EDIT:
I'm running my program on windows 7.
I'm trying to learn some image processing and make a simple flash game i made automated.
Rules: when the curses changes shape, click to get a point.
Also what imaging modules for python will allow you to take a specific size screenshot not just the whole screen? This question has moved to a new thread: "Taking Screen shots of specific size"
The way to do this in Windows is to install either a global message hook with SetWindowsHookEx or SetWinEventHook. (Alternatively, you could build a DLL that embeds Python and hooks into the browser or its Flash wrapper app and do it less intrusively from within the app, but that's much more work.)
The message you want is WM_SETCURSOR. Note that this is the message sent by Windows to the app to ask whether it wants to change the cursor, not a message sent when the cursor changes. So, IIRC, you will want to put a WH_CALLWNDPROC and a WH_CALLWNDPROCRET and check GetCursorInfo before and after to see if the app has done so.
So, how do you do this from Python? Honestly, if you don't already know both win32api and friends from the pywin32 package, and how to write Windows message procs in some language, you probably don't want to. If you do want to, I'd start off with the (abandoned) pyHook project from UNC Assist. Even if you can't get it working, it's full of useful source code.
You should also search SO for [python] SetWinEventHook and [python] SetWindowsHookEx, and google around a bit; there are some examples out there (I even wrote one here somewhere…)
You can look at higher-level wrapper frameworks like pywinauto and winGuiAuto, but as far as I know, none of them has much help for capturing events.
I believe there are other tools, maybe AutoIt, that have all the functionality you need, but not in Python module. (AutoIt, for example, has its own VB-like scripting language instead.)
i am using python/tkinter to write a IM software on XP. now i've got all the main functions done except i don't know how to highlight or change colour my IM item on taskbar on windows xp when window is minimized to the taskbar when a new message is received. i've search for this but just got c# solution. i need help on python. thanks!
I needed to do this for a tkinter python slack client I am writing and found http://wiki.tcl.tk/1049 . After a bit of guessing, I found that
Tk().deiconify()
Tk().focus_force()
(i.e. on the root window) does the trick. Windows doesn't actually change the focus and show the window since applications are not allowed to do that (Windows after XP) but it flashes the taskbar instead. It will keep flashing until clicked on but that seems to be the behaviour of Skype/Slack etc. Certainly close enough for many uses.
Obviously this is an old question but I couldn't find a concise, python only, answer and still needed one!
I'm not sure if there is a good way of doing this with Tk. Maybe somebody more knowledgeable will be able to point you in a better direction. Since Python is so dependent on OO, you may have a difficult time writing bindings to the Windows window manager.
If you don't find anything else, I did stumble on http://wiki.tcl.tk/4089, which manages Windows icons on the taskbar. Perhaps you could utilize this to simulate the taskbar flash that you want?
So I've been tinkering with a few different GUI's but I haven't been able to even find a point to begin researching this question:
How do I make a GUI like Steam (Digital distribution app) has? More specifically, I'm interested in how they manage to make their SHIFT+TAB menu pop up in-game, without disrupting/pausing/effecting the game. I've been somewhat successful in making a GUI window "stay on top" when a game is in window mode, but Steam pops this little menu up over the top of a running, fullscreen game.
That's what I'm interested in learning about. Any info would be much appreciated. :)
Sorry if this isn't the correct place to post this. I wasn't sure exactly where to ask.
PS> Preferably something I could implement in Python!!!
The Steam overlay/notification system hooks into games via Direct3D or OpenGL in Windows (depending on the game) from my understanding (as it doesn't work for games that aren't Direct3d/OpenGL like Diablo).
It uses the same rendering libraries that the game uses and thus can overlay their menus natively.
As for Python implementations, you can check out http://directpython.sourceforge.net/ and http://pyopengl.sourceforge.net/ as a start (for DirectX and OpenGL libraries respectively) but can I warn you that I don't think this is as simple as you're hoping.
Hmm, that looks very much like they are using Adobe AIR or maybe Flash.