[Tutor] Best way to learn Tkinter

Wayne Werner wayne at waynewerner.com
Wed Jul 17 13:35:27 CEST 2013


On Tue, 16 Jul 2013, Alan Gauld wrote:

> On 15/07/13 22:38, Ben Fishbein wrote:
>> Hello. I wrote a python program for my small business.
>> It works fine but it is all from command prompt and makes sense
>> to no one but me. I want to create a new version with a GUI
>> that an employee could use.
>
> I still like the Pythonware one:
>
> http://effbot.org/tkinterbook/
>
> But as an aside have you thought about making it a web app instead?
> That is much easier to maintain - no need to distribute updates etc.
> There are many fine Python web frameworks including Django and
> Pylons. If you can find a server to host it and your users are
> online it might be a better option.

Flask is another great choice, and one I find to be quite simple. If you 
have say, one computer at work that everybody uses, or a computer at work 
that is available on the network, any of these web frameworks would work 
just swell. Here's a sample Flask app:


from flask import Flask, request

app = Flask(__name__)


@app.route('/')
def main():
     name = request.args.get('name')
     if name:
         return "Hello, {}!".format(name)
     else:
         return "Hello, werld!"


if __name__ == "__main__":
     app.run('0.0.0.0',  #listens to the whole network
             debug=True, #Useful when developing. Auto restart on changes
             port=5000)  #Default port. Can be changed to any available num




Flask (as well as the others, I'm sure) also offer plugins that help with
forms, keeping users logged in, authenticating with OAuth...


I find it quite fantastic, personally, and use it on almost all my 
projects anymore. I even ported it to run on Python for Android and can 
run Flask apps on my phone. How awesome is that???

HTH,
Wayne


More information about the Tutor mailing list