WebApr 25, 2024 · 1 Answer. To create a regular polygon from a bounding box, you need to calculate the side length, and the apothem. The Apothem (the distance from the center to the mid-point of a side), is calculated from the side length. in the following example, the bbox is centered on the center of the polygon created; you can offset it as you please to ... WebAug 24, 2024 · As the comment in your linked question, your code is dragging the canvas widget, not the line. Also you do not clearly describe where the new line will be drawn. Actually your code will create a new line at the same position when the …
The Tkinter Canvas Widget - effbot.org
WebSep 21, 2024 · from tkinter import * from tkinter.ttk import * root = Tk () Label (root, text="Some Data").grid (row=0) Label (root, text="Some Data").grid (row=1) root.mainloop () Now this will display two widgets on row0 and row1. Now if I want to insert another (one or more) widget between these two rows at a later stage (say as a response to a button ... WebMar 9, 2013 · from Tkinter import Tk, Canvas master = Tk () w = Canvas (master, width=250, height=200) w.pack () w.create_rectangle (0, 0, 100, 100, fill="blue", outline = 'blue') master.mainloop () This creates one square/rectangle. How do I create a function so that it will create more than one square? python user-interface tkinter Share cornstarch supplier philippines
How to draw a vertical line without using Canvas?
WebSep 1, 2024 · Here is how to embed a matplotlib graph in a tkinter frame, draw lines on this graph from coordinates input by the user, and overlay an axis directly at the tkinter level: see also matplotlib docs for a simpler example. WebJul 7, 2016 · from Tkinter import * master = Tk () w = Canvas (master, width=200, height=100) w.pack () w.create_line (100, 0, 100, 100) #first 2 args are starting point of line and next 2 are ending point of line. mainloop () For adding other options, refer to canvas widget of tkinter Share Improve this answer Follow answered Jul 7, 2016 at 9:57 dazzieta WebMar 28, 2016 · from tkinter import * import time root = Tk () cans=Canvas (root,height=500,width=600) cans.pack () delay = 200 # milliseconds def draw_line (i=0): if i <= 150: cans.create_line (i,0,0,i) root.after (delay, draw_line, i+3) draw_line () root.mainloop () Share Improve this answer Follow answered Mar 28, 2016 at 23:10 … cornstarch structure