30

I am looking for a complete online reference for Python's tkinter module. I've tried to find one by myself, but for some reason I can't.

To clarify, I am not looking for a tutorial. Instead, I would like to have a reference for all the available classes and attributes.

For example, if I write this code:

from tkinter import *
root = Tk()
root.title("My title")

I wonder: what optional arguments does the Tk class accept for instantiation? What are properties and methods for a Tk object? What arguments does title accept? And so on...

"Look at the source" is not an answer to this question, obviously.

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
kynikos
  • 1,152
  • 4
  • 14
  • 25

4 Answers4

8

For a definitive guide to all of the options supported by each widget you should consult the tcl/tk documentation. It's a fairly trivial mental exercise to translate the tcl into python. The only real problems are when the tcl options conflict with python reserved words (such as the -in option for pack and grid)

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • They also have a python tutorial on the website, and after looking at it, I am beginning to wonder why I should use Tkinter widgets and not Tk since tk just look great on windows! – possumkeys Nov 04 '14 at 10:52
6

There were 2 books that were very useful to me:

They are very complete. They might be hard to find online.

nbro
  • 15,395
  • 32
  • 113
  • 196
  • 1
    [Mark Roseman's book](https://ipfs.io/ipfs/bafykbzaceboqjloczrd2d2asgd54kos4gulfalqp4zl4tkpcevdq4xvg4x4l6?filename=Mark%20Roseman%20-%20Modern%20Tkinter%20for%20Busy%20Python%20Developers_%20Quickly%20learn%20to%20create%20great%20looking%20user%20interfaces%20for%20Windows%2C%20Mac%20and%20Linux%20using%20Python%27s%20standard%20GUI%20toolkit%20%282012%29.pdf) – Amin Guermazi Aug 25 '21 at 22:24
  • 1
    [John Grayson's book](https://ipfs.io/ipfs/bafykbzaceaqfbusocy2ll4on7fznmism2zkkpfrvf2ilp3oxscgjiz5butcps?filename=John%20E%20Grayson%20Ph.D.%20-%20Python%20and%20Tkinter%20Programming-Manning%20Publications%20%282000%29.pdf) – Amin Guermazi Aug 25 '21 at 22:29
4

I'm adding an alternative answer by myself:

I could just use pydoc to have the complete module reference.

nbro
  • 15,395
  • 32
  • 113
  • 196
kynikos
  • 1,152
  • 4
  • 14
  • 25
  • 2
    The pydoc of Tkinter is not a complete reference. For example; in Python 3.5.2, \_\_init\_\_.py in tkinter module has two match of `validatecommand` string but there is no explanation around there about what it is or how it can be used. – ismailarilik Aug 28 '16 at 12:42
2

Some links no longer function - lately I've been relying on effbot for all my tkinter documentation needs.

Gershom Maes
  • 7,358
  • 2
  • 35
  • 55