From the course: Python GUI Development with Tkinter
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Drawing a basic line on the Canvas
From the course: Python GUI Development with Tkinter
Drawing a basic line on the Canvas
- [Instructor] The Canvas widget gives you space on which to draw and organize various shapes, images and even other widgets. It's power and flexibility make it suitable for all sorts of tasks from creating a basic drawing space or displaying a diagram to building your own custom widgets with a unique look and feel. In this video and then next one, I'll go through the process of creating a canvas and using some of the common methods for drawing lines and shapes to the canvas as well as adding images and other widgets. Since the canvas is not one of the themed Tk widgets, we'll only need to import the Tkinter package. Now, I'll create my top-level Tk window using the constructor method, and to create a canvas I'll use the canvas constructor method. I'll pass at the top-level window as the parent, and I'll use the pack method to put my canvas in the window. By default, the canvas is just a blank area of this size. We can specify the size of the canvas by configuring the width and height…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Entering and displaying multiple lines with the Text widget11m 31s
-
(Locked)
Adding tags, marks, images, and widgets to the Text widget9m 57s
-
(Locked)
Building a hierarchical treeview7m 19s
-
(Locked)
Adding columns and selecting items in the Treeview7m 12s
-
(Locked)
Building cascading menus11m 5s
-
(Locked)
Drawing a basic line on the Canvas5m 21s
-
(Locked)
Drawing complex shapes on the Canvas9m 58s
-
(Locked)
Attaching a scroll bar to widgets6m 21s
-
(Locked)
Configuring widget styles9m 49s
-
(Locked)
Prompting users with the Messagebox and dialogs6m 11s
-
(Locked)
-
-
-
-