Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'essentially': 0.04; 'resulting': 0.04; 'configure': 0.05; 'kind,': 0.05; 'result,': 0.07; 'back-end': 0.09; 'http': 0.09; 'output,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sentence': 0.09; 'python': 0.11; 'gui': 0.12; 'accepting': 0.14; 'template': 0.14; "wouldn't": 0.14; 'finney': 0.16; 'handling,': 0.16; 'inputs': 0.16; 'letting': 0.16; 'reasonably': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stake': 0.16; 'subject:Two': 0.16; 'subject:questions': 0.16; 'task.': 0.16; 'templating': 0.16; 'wrote:': 0.18; 'library': 0.18; 'input': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'simpler': 0.24; 'url:moin': 0.24; 'handling': 0.26; 'task': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'related': 0.29; 'easier': 0.31; 'requests': 0.31; 'url:wiki': 0.31; 'extract': 0.31; 'writes:': 0.31; 'anyone': 0.31; 'class': 0.32; 'this.': 0.32; 'handled': 0.32; 'interface': 0.32; 'run': 0.32; 'url:python': 0.33; 'framework': 0.33; 'candidate': 0.34; 'knowledge': 0.35; 'basic': 0.35; 'tool': 0.35; 'something': 0.35; 'case,': 0.35; 'etc.)': 0.35; 'form.': 0.35; 'there': 0.35; 'url:org': 0.36; 'so,': 0.37; 'turn': 0.37; 'implement': 0.38; 'server': 0.38; 'ben': 0.38; 'form,': 0.38; 'process,': 0.38; 'tasks': 0.38; 'url:library': 0.38; 'handle': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'generating': 0.39; 'use.': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'according': 0.40; '8bit%:29': 0.60; 'serving': 0.60; 'simple,': 0.60; 'url:3': 0.61; 'details.': 0.61; "you're": 0.61; 'first': 0.61; "you'll": 0.62; 'map': 0.64; 'networking': 0.64; 'subject:more': 0.64; 'different': 0.65; 'assistance': 0.66; 'response.': 0.68; 'receive': 0.70; 'incoming': 0.72; 'bar:': 0.84; 'bare': 0.84; 'catholic': 0.84; 'church': 0.84; 'hunting!': 0.84; 'received:125': 0.84; 'skip:\xe2 30': 0.91; 'rating': 0.93; 'responses': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Two more newbie questions Date: Fri, 18 Jul 2014 19:45:55 +1000 References: <85tx6fqdmc.fsf@benfinney.id.au> <1405674482.7795.9.camel@mobileDragon> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:zS6duO1DyoXFQYzWV1RHlNskeWE= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 83 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405676776 news.xs4all.nl 2869 [2001:888:2000:d::a6]:34881 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74736 Shieldfire writes: > On fre, 2014-07-18 at 18:23 +1000, Ben Finney wrote: > > So, if by “slap a GUI onto” you mean something that is a no-frills > > plain-HTML form, with essentially no assistance for the user and no > > error handling, this will be a lot simpler to implement than > > something easier for the human to use. > > Pretty much this. Because anyone using the tool would understand what to > enter. There are things like opponent, result, tournament and rating > without which there wouldn't be a need to use the tool in the first > place. In that case, design the UI as an HTML form; this is a task that requires no knowledge of Python, since you're just writing according to basic HTML. The Amazing Gezundheiticator

The Amazing Gezundheiticator

Fill out the inputs to the program and submit the form.

That's the input part of the UI; the other part is a response page with whatever result (error output, requested output, whatever) your back-end program will create. You'll need to write HTML pages for all the different kinds of responses your program can produce. It submits the input as an HTTP request to ‘/uri/to/backend-program’. The web server's job is to turn that URI into a call to your Python program; and your program then needs to extract from the HTTP request the values to process, and generate an HTTP response. So you have these additional, related tasks for your UI: * Accepting HTTP requests and routing them to your back-end program. You'll need to run a web server of some kind, and configure a map of routes from incoming URIs to the corresponding program to handle them . * Generating HTML for all the different kinds of response (requested output, error output, requests to re-try, etc.) from the back-end program. This is the job of an HTML templating library; see for details. Start simple, with a very bare HTML template populated using the standard library's ‘string.Template’ class . * Serving the resulting generated page as an HTTP response. This needs to be handled in a standard way to conform to networking and web-browser expectations. The library handling your interface to the web server is the best candidate for this task. If you want a small framework to handle these while letting you keep your configuration work reasonably simple, I recommend Bottle . Good hunting! -- \ “Perchance you who pronounce my sentence are in greater fear | `\ than I who receive it.” —Giordano Bruno, burned at the stake by | _o__) the Catholic church for the heresy of heliocentrism, 1600-02-16 | Ben Finney