Creating a Simple User Interface for a Function

Dave Angel davea at davea.name
Fri Jul 26 01:01:46 CEST 2013


On 07/25/2013 04:58 PM, CTSB01 wrote:

    <snip>
>
> Sorry Dave, to answer each part of your response:
>
> 1) I decided to use Python 2.7, and I will be sure to specify this in all future threads.
> 2) It is a list of positive integers.  In fact, it is always going to be a list of positive increasing integers.
> 3) You're right.  What I meant was that if after running that bit of code I enter
>>>> x = [0,1,2,3,4,5]
>>>> psi_j(x,2)
> I will get output that matches my requirements.
> 4) Yes, sorry that's what I meant (if I understood correctly).  I was told elsewhere that I might want to try using tkinter.  Essentially I'm trying to create a user interface that allows the user to just type in a string 01112345 for example, and choose a parameter (say j=2) and then click a button to run the function.  I'd like to be able to run send a .exe file

But Linux doesn't understand exe files.

Once again, you need to tell us your environment.  I'm now supposing you 
mean your user will be using Windows.  I have no experience with making 
a single runnable .exe file for Windows.  But many others here do, and 
can presumably help you.


> that the user can just open up and use with no further setup.
>
> So on top of the user interface I would also it looks like need to determine how to make Python change a string 01112345 into a list so that it does that automatically when the user clicks 'run'.

Since you give no upper limits to the numbers the user might be 
specifying (other than saying their strictly positively monatonic), the 
string "01112345" could be interpreted only as:


0, 1, 11, 23, 45
0, 11, 12, 345
0, 11, 12345
0, 111, 2345

(If the individual numbers were limited to the range 0-9, then we'd come 
up with the sequence 0,1,1,1,2,3,4,5, but that's not increasing, so it 
wouldn't be legal.)

Is there a reason you don't want the user to have to separate the 
numbers, either with spaces or commas?  If they typed  "0 1 11 23 45" 
you could trivially parse that with something like:
     [int(x) for x in data.split()]


>
> Would a shebang still be the right way to go?

A shebang is a Linux/Unix concept.  Although with Python 3.3 there's a 
similar Windows concept that lets a user switch between Python versions 
using the shebang, it's not really the same thing, and we shouldn't 
discuss it till we know whether you're talking Windows or Linux.

>
> Thanks again Dave, apologies for the ambiguity.
>


-- 
DaveA




More information about the Python-list mailing list