In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, the editor will bring you about Python programming tkinter library Canvas how to achieve graffiti color table and go board, the article is rich in content and professional analysis and description for you, I hope you can get something after reading this article.
There are three examples of Canvas operation in tkinter library one: graffiti import tkinter as tkimport pyautogui as agfrom time import sleepdef paint (event): X1, y1 = (event.x-1), (event.y-1) x2, y2 = (event.x + 1), (event.y + 1) tCanvas.create_oval (x1, y1, x2, y2, fill = "black") def moveRect (wMagneh): ag.moveRel Duration=w/1000) # moveRel move # dragRel drag ag.moveRel (0m m h, duration=h/1000) ag.moveRel (- w m m 0, duration=w/1000) ag.moveRel (0m m m h, duration=h/1000) sleep (0.5) win = tk.Tk () X Y=ag.size () winPos = "640x480 +" winPos + = str ((XMel 640) / / 2) + "+" winPos + = str ((Ymai 480) / / 2) win.geometry (winPos) win.resizable (False, False) win.title ('Desktop Resolution:' + str (X) + "x" + str (Y) win.update () tCanvas = tk.Canvas (win, width = win.winfo_width (), height = 400, bg = 'white') tCanvas.pack (side = "top") tCanvas.bind (" Paint) tCanvas.update () tk.Label (win, text = "canvas drawing") .pack (side = "bottom") x0 = 150 60w y0ag.moveTo h = 350160x, y = win.winfo_rootx () + x0, win.winfo_rooty () + y0ag.moveTo (x, y, duration=0.5) moveRect (wh) # draw a straight line tCanvas.create_line (x0, x0, y0) tCanvas.create_line (x0, y0, x0) ) # you can assign the upper left and lower right coordinate points together to the variable coord = x0juw, y0qih, x0coord,fill='limegreen' (coord) coord = x0coord y0 + h, x0, y0tCanvas.create_line (coord,fill=' blue') tCanvas.update () moveRect # draw a rectangle coord = x0examples 1mlmlmlmltCanvas.createcylindricangle (coord,fill='limegreen') tCanvas.update () moveRect (HMH) # draw a circle or ellipse coord = x0wow TCanvas.update (coord,fill='deepskyblue') tCanvas.update () CHORD () ARC (ARC) sleep (1) sleep (1) coord = 100,100,300, 300tCanvas.create_arc (coord,start=0,extent=180) # draw a fan, bow or an arc # type = PIESLICE sector, CHORD arch, ARC arc Fill='gold') tCanvas.update () sleep (1) coord = 240,60,490,31 colors can also be represented by 6-digit hexadecimal GRB values for tCanvas.create_arc (coord,style=tk.CHORD,start=10,fill='#7CFC00') tCanvas.update () sleep (1) coord = 180,10,470, 300tCanvas.create_arc (coord,style=tk.ARC,width=3,dash=6,extent=-180) # parameters You can search the relevant parameter table win.mainloop () running effect picture on the Internet:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 300
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.