beetlebug▾
/

Command reference

Each Tk command of ztk has a page: its synopsis, its options with their defaults, its widget commands, examples that run, its errors, and how it differs from Tk 8.6. The guide pages of Widgets show the widgets in use, and each one links to the pages of its commands.

Type a part of a name in the field to find a command.

Widgets

  • button Makes a push button: a widget with a text or an image that runs a script when the user clicks it.
  • canvas Makes a canvas: an area for shapes, text, images, and widgets that a script draws and moves.
  • checkbutton Makes a checkbutton: a button with an indicator that the user turns on and off.
  • entry Makes an entry: a widget that edits one line of text.
  • frame Makes a frame: an empty widget that holds and groups other widgets.
  • label Makes a label: a widget that shows a text, an image, or both, and runs no script.
  • labelframe Makes a labelframe: a frame with a border and a label in the border.
  • listbox Makes a listbox: a widget that shows a list of text items and lets the user select items.
  • menu Makes a menu: a list of entries that run commands, set variables, or open other menus.
  • menubutton Makes a menubutton: a button that opens a menu.
  • message Makes a message: a widget that shows a text of more than one line.
  • panedwindow Makes a panedwindow: a row or a column of panes with sashes that the user drags to change their sizes.
  • radiobutton Makes a radiobutton: one button of a group in which the user selects one choice.
  • scale Makes a scale: a slider that selects a number in a range.
  • scrollbar Makes a scrollbar: a bar with a slider that scrolls the view of another widget.
  • spinbox Makes a spinbox: an entry with two arrows that step its value.
  • text Makes a text: a widget that shows and edits text of many lines, with tags, marks, images, and widgets.
  • toplevel Makes a toplevel: a widget with a window of its own on the desktop.

ttk widgets

  • ttk::button Makes a themed push button: a widget with a text or an image that runs a script when the user clicks it.
  • ttk::checkbutton Makes a themed check button: a box with a text that the user turns on and off.
  • ttk::combobox Makes a themed combobox: an entry field with a drop-down list of values.
  • ttk::entry Makes a themed entry: a field of one line of text that the user can edit.
  • ttk::frame Makes a themed frame: a container that groups other widgets, with an optional border.
  • ttk::label Makes a themed label: a widget that shows a text, an image, or both, and runs no script.
  • ttk::labelframe Makes a themed labelframe: a frame with a border and a title.
  • ttk::menubutton Makes a themed menubutton: a button that opens a menu.
  • ttk::notebook Makes a themed notebook: a row of tabs over an area that shows one page at a time.
  • ttk::panedwindow Makes a themed paned window: panes in a row or a column, with sashes that the user drags to resize them.
  • ttk::progressbar Makes a themed progress bar: a bar that shows how much of a task is done, or that a task runs.
  • ttk::radiobutton Makes a themed radio button: one button of a group that shares a variable, with one button on at a time.
  • ttk::scale Makes a themed scale: a slider that the user drags to pick a number in a range.
  • ttk::scrollbar Makes a themed scrollbar: a bar that shows and moves the visible part of another widget.
  • ttk::separator Makes a themed separator: a thin line between groups of widgets.
  • ttk::sizegrip Makes a themed size grip: a handle in the corner of a window that the user drags to resize the window.
  • ttk::spinbox Makes a themed spinbox: an entry field with arrows that step a number or a value of a list.
  • ttk::style Gives and sets the options of the styles and the themes of the themed widgets.
  • ttk::treeview Makes a themed tree view: a list of items in a tree, with columns of values and a row of headings.

Geometry

  • grid Puts widgets in the cells of a table of rows and columns in a container.
  • pack Puts widgets in a container in order, each one against a side of the space that is left.
  • place Puts a widget at a fixed place and size in a container, in pixels or in fractions of the container.

Events and focus

  • bind Gives or sets the script that an event of a widget, a class, or another tag runs.
  • bindtags Gives or sets the list of binding tags of a widget, in the order that its events use them.
  • clipboard Puts text on the clipboard and reads it back.
  • event Defines virtual events, and sends events to widgets from a script.
  • focus Gives or sets the widget that gets the keys of the keyboard.
  • grab Keeps the pointer events of the application in one widget and its descendants.
  • selection Gives a selection an owner window and a handler, and reads the data of a selection.
  • tkwait Runs the event loop until a variable changes, a widget shows, or a widget is destroyed.

Window manager

  • destroy Deletes widgets, with each of their descendants and their widget commands.
  • lower Moves a widget below its siblings in the stacking order.
  • raise Moves a widget above its siblings in the stacking order.
  • winfo Gives facts about widgets and the screen: the size, the position, the tree, the class, and the colors.
  • wm Gives or sets the properties of a toplevel window: the title, the size, the state, and the hints for the window manager.

Dialogs

  • tk_chooseColor Shows a dialog to choose a color, and gives the color in the form #RRGGBB.
  • tk_chooseDirectory Shows a dialog to choose a folder, and gives its path.
  • tk_getOpenFile Shows a dialog to choose a file to open, and gives its path.
  • tk_getSaveFile Shows a dialog to choose the name of a file to save, and gives its path.
  • tk_messageBox Shows a message with a set of buttons, waits for the user to click one, and gives its name.
  • tk_popup Shows a menu as a popup at a point of the screen.

Images and fonts

  • font Makes named fonts, changes them, and measures text in a font.
  • image Makes images, gives their size and type, and deletes them.

Other

  • bell Rings the bell of the display: in ztk, the command checks its options and makes no sound.
  • option Adds, reads, and clears the entries of the option database, which gives the default options of new widgets.
  • tk Gives and sets facts of the app: its name, its scale, its windowing system, and the state of the input.
  • ztk::game Runs the loop of a 2D game, reads its input as actions, and keeps its random numbers, its fit, and its saves.
  • ztk::photo Resizes, crops, turns, and mirrors a photo, and reads the EXIF orientation of an image file.