Skip to Content
Tkinter GUI Application Development Blueprints, Second Edition - Second Edition
book

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

by Bhaskar Chaudhary
March 2018
Beginner to intermediate
422 pages
10h 33m
English
Packt Publishing
Content preview from Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Drawing irregular lines

To add the capability to draw irregular lines, we just need to define the method named draw_irregular_line. To specify options that appear in the top bar, we need to define the method named draw_irregular_line_options.

We define the draw_irregular_line method as follows (see code 6.07.py):

def draw_irregular_line(self): self.current_item = self.canvas.create_line(   self.start_x, self.start_y, self.end_x, self.end_y, fill=self.fill,      width=self.width) self.canvas.bind("<B1-Motion>", self.draw_irregular_line_update_x_y)def draw_irregular_line_update_x_y(self, event=None): self.start_x, self.start_y = self.end_x, self.end_y self.end_x, self.end_y = event.x, event.y self.draw_irregular_line()

The preceding code is similar ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Tkinter GUI Application Development Blueprints

Tkinter GUI Application Development Blueprints

Bhaskar Chaudhary

Publisher Resources

ISBN: 9781788837460Supplemental Content