Skip to content

Default values in tkinter stubs #10947

Open
@Akuli

Description

@Akuli

Tkinter is very dynamic. Most keyword arguments are passed to Tcl, and their behavior is described best in manual pages written for Tcl users. This means that when we ran stubdefaulter to figure out default values for most functions in typeshed, it didn't do much for tkinter, and most of tkinter's default values are still = ....

I (or someone else) should go through the = ... occurrences and fill in whatever can be filled. Often the default values are platform-specific, and hard-coding something into the stubs doesn't make sense.

Most defaults in tkinter are widget options (__init__ and configure() methods). To see their default values on your system, you can instantiate the widget and convert it to a dict. For example:

>>> import pprint
>>> import tkinter
>>> pprint.pprint(dict(tkinter.Text()))
{'autoseparators': 1,
 'background': '#3b3b3e',
 'bd': 1,
 'bg': '#3b3b3e',
 'blockcursor': 0,
 'borderwidth': 1,
 'cursor': 'xterm',
 'endline': '',
 'exportselection': 1,
 'fg': '#ffffff',
 'font': 'TkFixedFont',
 'foreground': '#ffffff',
 'height': 24,
 'highlightbackground': '#3b3b3e',
 'highlightcolor': '#ffffff',
 'highlightthickness': 1,
 'inactiveselectbackground': '#c3c3c3',
 'insertbackground': '#000000',
 'insertborderwidth': 0,
 'insertofftime': 300,
 'insertontime': 600,
 'insertunfocussed': 'none',
 'insertwidth': 2,
 'maxundo': 0,
 'padx': 1,
 'pady': 1,
 'relief': 'sunken',
 'selectbackground': '#7d7d82',
 'selectborderwidth': <pixel object: '0'>,
 'selectforeground': '#ffffff',
 'setgrid': 0,
 'spacing1': 0,
 'spacing2': 0,
 'spacing3': 0,
 'startline': '',
 'state': 'normal',
 'tabs': '',
 'tabstyle': 'tabular',
 'takefocus': '',
 'undo': 0,
 'width': 80,
 'wrap': 'char',
 'xscrollcommand': '',
 'yscrollcommand': ''}

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedAn actionable problem of low to medium complexity where a PR would be very welcometopic: tkintertkinter-related issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions