I&C SCI 32 Lecture Notes - Lecture 14: Tkinter, Function Object, Ellipse

30 views3 pages

Document Summary

This example is one that i affectionately call the scribble application. It consists of a window in which the user can draw by holding down the primary mouse button and then moving the mouse around. It demonstrates two new techniques: the use of the canvas widget and custom drawing, and (perhaps more importantly) the use of object-oriented programming to simplify tkinter-based gui implementation. The tkinter library includes a widget called canvas, which provides the ability to do programmatic drawing of shapes like lines, rectangles, ovals, and arcs. Getting started with the canvas widget is straightforward. You create one the same way you create any other widget, by calling the tkinter. canvas constructor and setting its options using keyword arguments. >>> canvas = tkinter. canvas(width = 500, height = 400, background = Note that, in practice, you"d also want to set its master option and have it participate in a layout. The complete code example linked below uses that technique.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents