Pregunta

Anyone know a web page with good, small examples of easy GUI creation in Tk and easy programming in Tcl? http://wiki.tcl.tk/1291 has a lot of examples, but only the larger ones have screenshots.

¿Fue útil?

Solución

I prefer something more live than a screenshot; those don't show the power of any GUI toolkit. (You can mock a screenshot in photoshop, but a live interactive demonstrator is hard to fake!)

What you want is the widget demo. This is an application that is supplied with Tk which shows many things you can do with Tk's widgets. It's inspired a number of things I've written in the past, and showcases many of the features and capabilities of Tk in digestible pieces. You can watch the code in action, read the code that did it, and even change the code and rerun the demo to see how it changes (including whether you broke it).


If you're using Tk on OS X, launch the widget demo by running wish without any arguments and choosing Run Widget Demo from the default File menu. (That menu gets removed once you start defining your own menus, of course.)

If you've installed ActiveTcl on Windows (the normal way to install on that platform), the widget demo should be one of the entries in the ActiveTcl submenu/folder on the Start menu/screen.

I don't know whether the widget demo is included with default packaging of Tk on various Linuxes and other Unixes. (I think it should be, but I've not got an easy way to check from here. I know we ship it in the source distribution, but stuff gets hacked around by distros.) If you need to download it, you can get it as a ZIP direct from our source repository:

If you look at those URLs, you might be able to guess a pattern…

Otros consejos

I found tkdocs very useful.

This site also contain examples in Perl, Python and Ruby

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top