I am going to write simple "to do list" app in python. One of the features will be possibility to configure notifications/reminders for tasks. If user will be using GUI I am going to use some popup windows, but what if he runs the app in the terminal, without any GUI? What would be the best equivalent for that? Is there a possibility to somehow notify the user?
I will be thankful for any guidance or at least direction, I tried searching for all variants of "terminal/console/text" + "notifications/popups" but I did not find anything interesting...
Related
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 writing a calculator currently and I'd like to have results displayed in a visually appealing form. The program just has a command line interface for the moment, but I've been trying to find a way to do various things with the results it displays. For example, I'd like to have it display the result in a bigger font size, a different font than system default, and even subscripts and superscripts. From what I could find, the best way to do such things would be if I introduced a GUI and used something like wxPython, and using Unicode code points can only resolve part of the issue. Moreover, for various reasons, I'd just like to have the program in command line for the moment.
I don't think you can accomplish this with the command line, but you might check out curses. I would suggest picking up a GUI for this sort of thing. It's really not too hard to learn and Python's builtin Tkinter is perfectly functional for getting started. There are many good resources for Tkinter. Here are a few I like:
effbot.org
Thinking in Tkinter
An Introduction to Tkinter
WxPython is excellent, but if you are just getting started my suggestion would be to start with Tkinter. Others might disagree...
EDIT
I just remembered running across the console module for Windows. I suspect it won't won't get you what you want, but at least it's out there.
If you're running this on the command line, I'm almost certain that there's nothing you can do to override the font preferences set by the user. In both windows and Linux, the font settings of the command line are user controlled, and I doubt that you can change it without sudo access. Seeing as you're writing a calculator, I don't think a user would want to run it as sudo - I certainly wouldn't want to run something as simple as a calculator with sudo privileges. To require that would make the user think that you are up to something malicious
I am trying to send a couple basic text commands to a flash program running in Firefox on Windows 7, but I am unable to get pywinauto working for me.
Right now, I have just been able to accomplish the very basic task of connecting to Firefox plugin-container by directing it to the path using the following code:
from pywinauto import application
app = application.Application()
app.connect_(path = r"c:\Program Files (x86)\Mozilla Firefox\plugin-container.exe")
The next step seems to be something to the effect of:
app.plugin-container.Edit.TypeKeys('Text')
However, I can't reference the plugin-container window using '.plugin-container', or any combination of those words. I have tried adding a title variable to the connect_() function and I have tried everything I can think of to find out how to type the command.
The example I am basing this off of is the notepad sample:
from pywinauto import application
app.start_(ur"notepad.exe")
app.Notepad.Edit.TypeKeys(u"{END}{ENTER}SendText d\xf6\xe9s "
u"s\xfcpp\xf4rt \xe0cce\xf1ted characters!!!", with_spaces = True)
It doesn't matter to me if I use pywinauto or Firefox. If it is any easier to do this using a different module or Internet Explorer, I'm on board for whatever accomplishes the task. I am using Python version 2.7.2 and would prefer it over any version changes.
Any help at all is appreciated. I am pretty lost in all this.
As the author of pywinauto - I think you are going to have a hard time. pywinauto only really helps with standard windows controls, and I don't think that flash controls are implemented as standard windows controls (Buttons, Edit boxes, etc).
OFf the top of my head - I would think Sikuli may be a better starting point (http://sikuli.org/).
Another option may be 'http://code.google.com/p/flash-selenium/' - I just googled for "automating flash input" - and it turned up in one of the first articles I clicked.
Thanks for trying pywinauto - I just don't think it is best suited for Flash automation.
I am a new programmer with little experience but I am in the process of learning Python 2.7. I use Python(x,y) or Spydar as the programs are called on Windows 7.
The main packages I'm using are numpy, pil and potentially win32gui.
I am currently trying to write a program to mine information from a 3rd-party software. This is against their wishes and they have made it difficult. I'm using ImageGrab and then numpy to get some results. This however, or so i belive, forces me to keep the window I want to read in focus, which is not optimal.
I'm wondering if there is any way to hijack the whole window and redirect the output directly into a "virtual" copy, just so I can have it running in the background?
When looking at the demos for win32api, there is a script called desktopmanager. I never got it to work, probably since I'm running Windows 7, that's supposed to create new desktops. I don't really know how multiple desktops work but if they run in parallel, there may be a way to create a new desktop around a current window. I don't know how, it's just a thought so far.
The reason it's not working for me is not that it's not creating a new desktop, it's that once it's been created, I can't return from it. The taskbar icon nor the taskbar itself ever appears.
One approach that might work would be to do something like so:
get the window handle (FindWindow() or something similar, there are a few ways to do this)
get the window dimensions (GetClientRect() or GetWindowRect())
get the device context for the window (GetWindowDC())
get the image data from the window (BitBlt() or similar)
It is possible that you will need elevated privelages to access another processes window dc, if so you may need to inject code/dll into the target process space to do this.
HTH.
I saw here a solution, but i don't want wait until the key is pressed. I want to get the last key pressed.
The related question may help you, as #S.Lott mentioned: Detect in python which keys are pressed
I am writting in, though to give yu advice: don't worry about that.
What kind of program are you trying to produce?
Programas running on a terminal usually don't have an interface in which getting "live" keystrokes is interesting. Not nowadays. For programs running in the terminal, you should worry about a usefull command line User Interfase, using the optparse or other modules.
For interative programs, you should use a GUI library and create a decent UI for your users, instead of reinventing the wheel.Which wouldb eb etter for what you ar trying to do? Theuser click on an icon,a window opens on the screen, witha couple of buttons on it, and half a dozen or so menu options packed under a "File" menu as all the otehr windws on the screen - or - a black terminal opens up, with an 80's looking text interface with some blue-highlighted menu options and so on?. You can use Tkinter for simple windowed applications, as it comes pre-installed with Python + Windows, so that yoru users don't have to worry about installign aditional libraries.
Rephrasing it just to be clear: Any program that requires a user interface should either se a GUI library, or have a WEB interface. It is a waste of your time, and that of your users, to try and create a UI operating over the terminal - we are not in 1989 any more.
If you absolutely need a text interface, you should look at the ncurses library then. Better than trying to reinvent the wheel.
http://code.activestate.com/recipes/134892/
i think it's what you need
ps ooops, i didn't see it's the same solution you rejected...why, btw?
edit:
do you know:
from msvcrt import getch
it works only in windows, however...
(and it is generalised in the above link)
from here: http://www.daniweb.com/forums/thread115282.html