[Tkinter-discuss] Mapping Tcl's arguments to Python's arguments

Bryan Oakley bryan.oakley at gmail.com
Thu Jan 4 10:12:02 EST 2018


You cannot generalize tcl arguments. The tcl syntax is exceptionally
simple: every statement starts with a command, and every "word" after that
is an argument. A "word" can be just that - a single word, or a collection
of characters inside quotes.  It is up to each individual command as to how
it interprets arguments. Tcl commands tend to use optional arguments that
begin with a dash like a python keyword argument (eg: -background blue /
background="blue") but this isn't always the case. There's nothing enforced
by the language to require that options begin with "-", and the tcl
language doesn't require that positional arguments and keyword arguments
come in any particular order or that options must be followed by a value.

In the context of tk and tkinter, widget options typically begin with "-"
in tcl/tk, and are treated as keyword arguments in python/tkinter (eg:
-background blue / background="blue").

On Wed, Jan 3, 2018 at 3:42 PM, adil gourinda <rikudou__sennin at outlook.com>
wrote:

> Please can someone illuminate the differences between Tcl's arguments and
> Python's arguments?
>
> After reading a little about tcl/Tk I found that the arguments are written
> in the forms:
> 1) -option (the option's name alone is an argument)
> 2) -option value (with description of value's type)
> 3) value (only the value's description exists, no "-option")
> 4) ?expression?
>
> Python opponents:
> 1) option=Boolean_Value
> 2) "*,option=value", keyword-only argument (but value is the default
> argument, not its nature)
> 3) is positional argument and the value's name is passed to option's name.
> 4) can you explain the difference between function(option1=value
> [,option2])
>
> *2)+3) are grouped in positional-keyword argument
>
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> https://mail.python.org/mailman/listinfo/tkinter-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20180104/db641c4b/attachment.html>


More information about the Tkinter-discuss mailing list