~/ learn/ comp-325/ cards/ Tkinter GUIs in Python 3
1 of 13

Constructing the root window and the labelled inputs

Constructing the root window and the labelled inputs

Answer

import tkinter as tk root = tk.Tk() root.title("Ping a host") host_entry = tk.Entry(root, width=24) count_entry = tk.Entry(root, width=6) status = tk.Label(root, text="")

The module is `tkinter`, lower case, in Python 3. Every widget takes its parent as the first argument. Constructing a widget does not make it visible — that is the geometry manager's job, on a separate call.

Python 3 documentation: tkinter, tkinter.ttk, subprocess (docs.python.org/3)

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/12991c80-2c3b-4a05-be66-17edbe6db71e/flashcard utf-8 LF