[Tutor] Custom Input Subprocess
Dave Angel
davea at davea.name
Thu Oct 31 03:24:03 CET 2013
On 30/10/2013 19:49, Kenny Stier' wrote:
> I am brand new to Python, and I would like to create a GUI Program that
> downloads files at certain times using the Linux terminal. I have the Linux
> terminal part down, and using subprocess can execute that, but I can't
> allow people to, in the GUI, input some of the command in themselves. The
> current code I have is
>
> import subprocess
> subprocess.call(["at", "-f", "download.sh", "7:11 PM"])
>
> But using the GUI, they need to be able to input their own text where the
> time is, and where it says "download.sh". How do I do this? Thanks!
How many other languages are you skilled at doing GUI in? And which GUI
library did you plan to use here?
Maybe you need to first solve the problem in a "Linux terminal," since
writing a GUI is maybe 50 times as hard as writing a terminal program.
In your subprocess call, just use
subprocess.call(["at", "-f", scriptname, time_string])
where you've previously gotten scriptname and time_string from the user.
In a terminal program, you'd use input() to get them (assuming Python
3.x).
--
DaveA
More information about the Tutor
mailing list