What is the difference between a Canvas and a Text widget in Python?
Canvas draws shapes and images as movable items; Text edits and formats multi-line text. See tkinter examples and a comparison table.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Canvas draws shapes and images as movable items; Text edits and formats multi-line text. See tkinter examples and a comparison table.
Build reusable custom widgets in Python by subclassing ttk.Frame, Canvas or QWidget, with clear APIs, signals and custom painting.
Build message boxes and custom modal dialogs in Python with Tkinter Toplevel and PyQt6 QDialog, and return results to the main window.
A Label displays text or an image, while a Button runs a function when clicked. See tkinter and ttk examples with a comparison table.
A window is a top-level surface with a title bar, a frame is a child container that groups widgets. See the difference in Tkinter and Qt with code.
Learn how to capture key presses, modifiers and shortcuts in Tkinter and PyQt6, with runnable examples and fixes for common focus problems.
Learn to react to left, right and double clicks in Python with Tkinter and PyQt6, including how to read the click position.
Show images in a Python window using Tkinter with Pillow or PyQt6, resize them to fit, open files with a dialog and avoid the blank image bug.
Create a desktop GUI in Python with Tkinter or Qt. Compare the main toolkits, see working code for each and learn how to keep the interface responsive.
Tkinter ships with Python and suits simple tools, while PyQt6 offers a far richer widget set for professional apps. Compare features, tooling and licensing.
Set, read and delete cookies in Python with http.cookies, Flask, Django, FastAPI and requests.Session, and secure them with HttpOnly, Secure and SameSite.
Compare Python HTTP clients and learn to send GET, POST, PUT, PATCH and DELETE requests with timeouts, JSON bodies and proper error handling.
DictReader turns CSV rows into dictionaries, DictWriter writes dictionaries back to CSV. See fieldnames, headers and error handling.
Learn to parse XML in Python with ElementTree: navigate elements and attributes, handle namespaces, edit and save files, and stream large documents.
Use sorted() or list.sort() with a key function such as itemgetter. Covers descending order, multiple keys, mixed order, missing keys and case-insensitive sorting.
The == operator compares values, while is compares object identity. See why small integers behave oddly and why you should write is None.
isinstance() checks an object against a class, a tuple of classes or a union and respects inheritance. Learn when to use it instead of type() and match.
enumerate() adds a counter to any iterable so you get the index and item together. Learn the syntax, start parameter and patterns that beat range(len()).
filter returns the items that satisfy a condition, and reduce folds a whole iterable into one result. See examples and when to prefer comprehensions.
See how polymorphism works in Python through overriding, duck typing, protocols and singledispatch, with runnable examples and clear guidance on when to use each.