Skip to content

tkinter documentation: font data type error and two minor suggestions #99089

Description

@Magnymbus

Packer Options

Anchor:

Very minor gripe that this does not include the legal values while the other parameters do.
I recommend appending the following sentence for clarity:

Legal values are points of the compass: "n", "ne", "e", "se", "s", "sw", "w", "nw", and also "center".

Tk Option Data Types

Font:

Tk uses a list font name format, such as {courier 10 bold}.

The example provided does not function, as it is using improper syntax (Note the curly brackets). The section should be corrected to reflect expected usage. This is the definition provided in typeshed/stdlib/tkinter/font.pyi : L15:

_FontDescription: TypeAlias = (
    str  # "Helvetica 12"
    | Font  # A font object constructed in Python
    | list[Any]  # ("Helvetica", 12, BOLD)
    | tuple[Any, ...]
    | _tkinter.Tcl_Obj  # A font object constructed in Tcl
)

Cursor:

You can also specify a bitmap and mask file of your own. See page 179 of Ousterhout’s book.

I recommend prepending the following sentence, as it is far more practical (in most situations) than the bitmap & mask method referenced.

To specify a cursor file (.cur or .ani), use the path to the file, preceded with an @, as in cursor="@path/to/cursor.cur"..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions