PyCon Australia 2013

Creando aplicaciones gráficas con Python y Tkinter

Russell Keith-Magee  · 

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

all right good afternoon everybody our last presentation in this session our next presenter is a seven year veteran of the django core team and president of the django software foundation this year he was lead organizer of django con Australia we're not

contributing to django his hobbies include asking questions at conferences to speak to us about saying that isn't django please welcome dr. Russel Keith McGee okay so thank you all very much as Ben I said I'm Russell Keith McGee my day job is as CTO

and co-founder of trades cloud we're a cloud provider of services software as a service to trades people doing back-office organization stuff for plumbers electricians that sort of thing if you're interested in migrating to Perth we're likely to

be hiring soon so come and come and have a chat or if you're already in Perth come and have a chat to me and as Ben I said that's just my day job in my spare time I'm a core developer on the Django project have been since January 2006 president

of the Django Software Foundation since 2010 for those who don't know the Django Software Foundation is the IPE legal fundraising arm of the Django project but for a twist Django isn't why I'm here today I'm I got on my django juice out on

Friday at the mini conference and I'm here today to introduce you or if you're old enough reintroduce you to a somewhat neglected corner of Python standard library a module called tick hunter why on earth would I want to do such a thing after all to

quote the Python wiki Cameron Laird calls the yearly decision to keep TK enter as one of the minor traditions of the Python world that is to say TK entities regularly put on the executioner's block but it's saved at last minute I would like to use

this opportunity to mount a defense of TK inter and more than that I'd like to suggest that we should all be using it a lot more than we currently are so what is TK inter alright TK inter is pythons interface to TK what's TK it's the graphics toolkit

that came as part of tickle for the youngins in the audience tickle or the tool control language is a scripting language it's a similar sort of vintage to Python itself that was started around 1990 it was very popular in the UNIX world in the 1990s it's

raison d'être was to be a common scripting language that you could embed into other UNIX tools and UNIX was just sort of coming into its own because of well the freeing up of BSD and and Linux coming on annex windows was around and still had this idea

about sort of a visual basic for UNIX essentially that we could have this common language to control all these tools now as a language it's a bit of a queer odd language but it's it has one very very interesting property every datatype including code

could be manipulated as a string and this made it very very easy to integrate with other systems because you only really need to implement a string into a string processing interface to actually get that that binding happening now it's part of its you

know it's designed to be easy to integrate so it was an easy to integrate language and essentially that's how tek works as an engine TK can display GUI windows dialogs buttons and so on and tickle into phases with TK using a string layer or using string

interface and it's the simplicity of that interface which is what makes it interesting from our perspective as Python as Python developers because there are TK interfaces to Perl to Ruby as well as Python because it is so easy to write an interface you

pass strings to the TK engine and windows appear and buttons appear and lo your brand new language has a fully functioning graphics toolkit for building user interfaces so on paper this sounds fantastic why is the Python wiki so unenthusiastic well like all

software TK has evolved over time if you're of a similar sort of vintage to myself then your memory of tickle TK is probably something a little bit like this Times New Roman text regardless of what operating system you're on colors that do not even

begin to remotely approximate system defaults the very best icons that X BMP icons that money can't buy extremely primitive widget sets you could get buttons and lists but no trees they were all rendered using motif widgets tiles and I don't know if

any of you have actually remember using motif essentially everything in motif was a button so you would end up with when you got to things like check boxes it wasn't a box with a checkmark in it until it was on it was a box that would look like it was

pressed or a box that wasn't pressed and if you had two of them next to each other and you only had two options you would be hard-pressed to tell which one was on and which one was off and so that was regardless of whether you're on OS X or Windows

or gtk or QT or whatever else is your underlying which is it at the API level it had a mind-numbing Lee complex layout API using this this approach called PAC and there's a bright shiny penny to anyone who can actually explain how the hell pack works and

to make matters worse the documentation was the usual mid-90s open source standard which is to say they existed so why am I being so bullish on TK inter well two things have changed two very important things have changed the first is TK 8.5 everything if the

last time you saw TK inter was was in the 90s or even in the mid to mid nineties TK is not the same anymore in ticket 8.5 came out in December of 2007 and introduced something called TK tile which was a new theming engine which meant that system colors system

fonts system widgets now became the default style when you started laying out your is read user interfaces so as a result dialogues look like system native dialogues windows look like system native windows and in the case of the dialogues more often than not

they actually are the system native dialogue so when you have a file widget or four Open File widget you're actually using your operating systems open file widget not some weird created thing that T's on some UNIX TK guide that won't be a good

idea built-in motif there's also a new layout system called grid which unlike pack makes sense and there's a lot closer to the sort of lay up systems that you'd be familiar with if you've ever done any sort of GUI programming in an API like

Java swing or something like that and the widget set is now a lot richer by default it's not perfect there are still some sort of summer missions that I would be useful to have but it definitely covers a lot more of the basics at the very least you have

a very good canvas widget you have a very good tree widget that you can now use the second thing that's changed the docs don't suck anymore an unofficial website called TK Doc's as emerged alright someone who actually is a TK fan and it is quite

frankly awesome it is both tutorial and reference and the docs don't assume it is literally tech hey Doc's not tickle Doc's about TK so all of the dot all the examples they give are cross language so every example is given in tickle Perl Ruby and

Python now the Doc's aren't complete it is a work in progress especially when you get to the reference section but even in their incomplete form they're pretty good and they can give you at least enough of an indication of where in the TK official

Docs you might want to look for certain of the at certain other details okay so one does not simply TK inter well yes one does let's walk through an example in this case where I'm actually going to use here the example from TK Doc's itself the

[ ... ]

Nota: se han omitido las otras 3.767 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.