Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51265

Re: Creating a Simple User Interface for a Function

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Creating a Simple User Interface for a Function
Date 2013-07-25 19:00 -0400
References <cebb4f86-c546-4283-a839-46393571cbb0@googlegroups.com> <mailman.5116.1374779986.3114.python-list@python.org> <97f8224f-e73b-4a4b-bf05-7cc3dba4e9d9@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.5122.1374793265.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 7/25/2013 4:58 PM, CTSB01 wrote:

> 1) I decided to use Python 2.7, and I will be sure to specify this in
> all future threads.

Given that you are not using any libraries, let alone one that does not
run on Python 3, I strongly recommend using the latest version (3.3).

> 2) It is a list of positive integers.  In fact, it is always going to
> be a list of positive increasing integers.

Your example below starts with 0, which is not positive.
Perhaps you mean that all integers after a single leading 0 have to be 
positive and increasing.

If you run digits together, then the max int is 9. Do you intend this?

> 4) Yes, sorry that's what I meant (if I understood correctly).  I was
> told elsewhere that I might want to try using tkinter.

If users start the program at a command line, the core of an input 
function would be
   input = (raw)input('Enter digits: ')  # Include "raw" on 2.x
You would need a more elaborate prompt printed first, and input checking 
with the request repeated if the input does not pass the check.

It would be pretty simple to do the equivalent with a tkinter dialog box.

> I'd like to be
> able to run send a .exe file that the user can just open up and use
> with no further setup.

There are programs that will package your code with an interpreter. But 
do give people the option to get just the program without installing a 
duplicate interpreter.

> 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'.

 >>> list('01112345')
['0', '1', '1', '1', '2', '3', '4', '5']
 >>> '0,1,1,1,2,3,4,5'.split(',')
['0', '1', '1', '1', '2', '3', '4', '5']

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

On Linux, definitely, whether you have user enter on the command line or
in response to a prompt. On windows, it only helps with 3.3+.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Creating a Simple User Interface for a Function CTSB01 <scott.moore270@gmail.com> - 2013-07-25 09:03 -0700
  Re: Creating a Simple User Interface for a Function Dave Angel <davea@davea.name> - 2013-07-25 15:19 -0400
    Re: Creating a Simple User Interface for a Function CTSB01 <scott.moore270@gmail.com> - 2013-07-25 13:58 -0700
      Re: Creating a Simple User Interface for a Function Terry Reedy <tjreedy@udel.edu> - 2013-07-25 19:00 -0400
      Re: Creating a Simple User Interface for a Function Dave Angel <davea@davea.name> - 2013-07-25 19:01 -0400
      Re: Creating a Simple User Interface for a Function Terry Reedy <tjreedy@udel.edu> - 2013-07-25 19:46 -0400
      RE: Creating a Simple User Interface for a Function "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2013-07-26 14:08 +0000

csiph-web