Gibt es für tkinter Vektorgrafik Bibliotheken?
Verfasst: Freitag 20. November 2015, 16:00
Ich meine, wäre schön, wenn es so etwas gäbe, damit man hier diverse Häuser, Autos und Sonstiges einfügen könnte:


Seit 2002 Diskussionen rund um die Programmiersprache Python
https://www.python-forum.de/
Code: Alles auswählen
<!DOCTYPE html>
<html>
<body>
<svg height="210" width="500">
<polygon points="200,10 250,190 160,210" style="fill:lime;stroke:purple;stroke-width:1" />
</svg>
</body>
</html>
Code: Alles auswählen
import tkinter as tk
root = tk.Tk()
canvas = tk.Canvas(root,height="210",width="500")
canvas.pack()
canvas.create_polygon(200,10,250,190,160,210,fill='lime',outline='purple', width=1)
root.mainloop()
Code: Alles auswählen
import tkinter as tk
import math
center_x = 110
center_y = 110
radius = 100
degree = -90
number = 5
def show_pentagramm(canvas,item):
global degree
thiscoords = []
for i in range(number):
radians = math.radians(degree)
x = math.cos(radians) * radius + center_x
y = math.sin(radians) * radius + center_y
thiscoords.append(x)
thiscoords.append(y)
degree -= 360/number*2
canvas.coords(item,*thiscoords)
def do_rotate(params):
global degree
canvas = params[0]
item = params[1]
show_pentagramm(canvas,item)
degree += 1
if degree == 360: degree = 0
canvas.after(10,do_rotate,(canvas,item))
root = tk.Tk()
canvas = tk.Canvas(root,width=220,height=220)
canvas.pack()
item = canvas.create_polygon(0,0,0,0,fill='blue')
do_rotate((canvas,item))
root.mainloop()
Code: Alles auswählen
import tkinter as tk
import math
center_x = 110
center_y = 110
radius = 100
degree = -90
number = 5
def show_pentagramm(canvas,item):
global degree
thiscoords = []
for i in range(number):
radians = math.radians(degree)
x = math.cos(radians) * radius + center_x
y = math.sin(radians) * radius + center_y
thiscoords.append(x)
thiscoords.append(y)
degree -= 360/number*2
canvas.coords(item,*thiscoords)
canvas.scale(item,center_x,center_y,(1.1+math.sin(radians))/2,(1.1+math.sin(radians))/2)
def do_rotate(params):
global degree
canvas = params[0]
item = params[1]
show_pentagramm(canvas,item)
degree += 1
if degree >= 360: degree = 0
canvas.after(10,do_rotate,(canvas,item))
root = tk.Tk()
canvas = tk.Canvas(root,width=220,height=220)
canvas.pack()
item = canvas.create_polygon(0,0,0,0,fill='blue')
do_rotate((canvas,item))
root.mainloop()
Code: Alles auswählen
import tkinter as tk
import math
center_x = 150
center_y = 110
radius = 100
degree = -90
number = 36
def n_polygon(canvas,item):
global degree
thiscoords = []
for i in range(number):
radians = math.radians(degree)
x = math.cos(radians) * radius + center_x
y = math.sin(radians) * radius + center_y
thiscoords.append(x)
thiscoords.append(y)
degree -= 360/number
canvas.coords(item,*thiscoords)
#canvas.scale(item,center_x,center_y,(1.1+math.sin(radians))/2,(1.1+math.sin(radians))/2)
def do_crop(canvas,item):
coords = canvas.coords(item)
count = int(len(coords)/2)
for index in range(count):
y = coords[index*2+1]
dy = y - center_y
coords[index*2] += dy
print('cropped')
canvas.coords(item,*coords)
root = tk.Tk()
canvas = tk.Canvas(root,width=300,height=220)
canvas.pack()
item = canvas.create_polygon(0,0,0,0,fill='gold',outline='blue',smooth='1',width=4)
number = 36
n_polygon(canvas,item)
do_crop(canvas,item)
root.mainloop()
Code: Alles auswählen
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.2" baseProfile="tiny" viewBox="0 0 21000 29700" preserveAspectRatio="xMidYMid" fill-rule="evenodd" clip-path="url(#presentation_clip_path)" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve">
<defs>
<clipPath id="presentation_clip_path" clipPathUnits="userSpaceOnUse">
<rect x="0" y="0" width="21000" height="29700"/>
</clipPath>
</defs>
<g id="id2" class="Master_Slide" clip-path="url(#presentation_clip_path)">
<g id="bg-id2" visibility="visible" class="Background">
<rect fill="none" stroke="none" x="0" y="0" width="21000" height="29700"/>
</g>
<g id="bo-id2" visibility="visible" class="BackgroundObjects"/>
</g>
<g id="id1" class="Slide" visibility="visible" clip-path="url(#presentation_clip_path)">
<g class="com.sun.star.drawing.ClosedBezierShape">
<g>
<path fill="rgb(43,169,225)" stroke="none" d="M 8988,4286 L 9770,3752 8655,3425 C 7723,1788 5822,2642 5186,4199 4420,6075 2224,6760 2224,6760 3787,8619 5196,8954 6136,8880 7077,8806 9615,8066 9087,4766 9059,4595 9026,4435 8988,4286 Z"/>
<rect fill="none" stroke="none" x="2224" y="2540" width="7547" height="6351"/>
</g>
</g>
<g class="com.sun.star.drawing.ClosedBezierShape">
<g>
<path fill="rgb(43,50,119)" stroke="none" d="M 8655,3426 C 8788,3660 8901,3945 8988,4286 L 9770,3753 8655,3426 Z"/>
<rect fill="none" stroke="none" x="8655" y="3426" width="1116" height="861"/>
</g>
</g>
<g class="com.sun.star.drawing.ClosedBezierShape">
<g>
<path fill="rgb(43,50,119)" stroke="none" d="M 7412,5497 C 7412,5497 4803,4959 4503,6411 4204,7863 6613,8705 7412,5497 Z"/>
<rect fill="none" stroke="none" x="4477" y="5400" width="2936" height="2304"/>
</g>
</g>
<g class="com.sun.star.drawing.ClosedBezierShape">
<g>
<path fill="rgb(43,50,119)" stroke="none" d="M 7915,3385 C 7932,3541 7852,3678 7735,3691 7618,3705 7509,3589 7491,3433 7473,3278 7554,3140 7671,3127 7788,3114 7897,3229 7915,3385 Z"/>
<rect fill="none" stroke="none" x="7487" y="3125" width="431" height="569"/>
</g>
</g>
</g>
</svg>
Code: Alles auswählen
import tkinter as tk
def transform_coords(dx,dy,scale,coords):
coord_list = list(coords)
count = int(len(coords)/2)
for index in range(count):
x = coord_list[index*2]
x = (x + dx) * scale
coord_list[index*2] = x
y = coord_list[index*2+1]
y = (y+dy)*scale
coord_list[index*2+1] = y
return coord_list
root = tk.Tk()
canvas = tk.Canvas(root,width=400,height=400)
canvas.pack()
dy = -1500
dx = -2000
scale = 0.05
#<path fill="rgb(43,169,225)" stroke="none" d="M 8988,4286 L 9770,3752 8655,3425 C 7723,1788 5822,2642 5186,4199 4420,6075 2224,6760 2224,6760 3787,8619 5196,8954 6136,8880 7077,8806 9615,8066 9087,4766 9059,4595 9026,4435 8988,4286 Z"/>#
canvas.create_polygon(*transform_coords(dx,dy,scale,(8988,4286,9770,3752,8655,3425,7723,1788,5822,2642,5186,4199,4420,6075,2224,6760,2224,6760,3787,8619,5196,8954,6136,8880,7077,8806,9615,8066,9087,4766,9059,4595,9026,4435,8988,4286)),fill='#2ba9e1',smooth=1)
#<path fill="rgb(43,50,119)" stroke="none" d="M 8655,3426 C 8788,3660 8901,3945 8988,4286 L 9770,3753 8655,3426 Z"/>
canvas.create_polygon(*transform_coords(dx,dy,scale,(8655,3426,8788,3660,8901,3945,8988,4286,9770,3753,8655,3426)),fill='#2b3277')
#<path fill="rgb(43,50,119)" stroke="none" d="M 7412,5497 C 7412,5497 4803,4959 4503,6411 4204,7863 6613,8705 7412,5497 Z"
canvas.create_polygon(*transform_coords(dx,dy,scale,(7412,5497,7412,5497,4803,4959,4503,6411,4204,7863,6613,8705,7412,5497)),fill='#2b3277',smooth=1)
#M 7915,3385 C 7932,3541 7852,3678 7735,3691 7618,3705 7509,3589 7491,3433 7473,3278 7554,3140 7671,3127 7788,3114 7897,3229 7915,3385 Z#
canvas.create_polygon(*transform_coords(dx,dy,scale,(7915,3385,7932,3541,7852,3678,7735,3691,7618,3705,7509,3589,7491,3433,7473,3278,7554,3140,7671,3127,7788,3114,7897,3229,7915,3385)),fill='#2b3277',smooth=1)
root.mainloop()
Code: Alles auswählen
import tkinter as tk
root = tk.Tk()
canvas = tk.Canvas(root,width=400,height=400)
canvas.pack()
dy = -1500
dx = -2000
scale = 0.05
item = canvas.create_polygon(8988,4286,9770,3752,8655,3425,7723,1788,5822,2642,5186,4199,4420,6075,2224,6760,2224,6760,3787,8619,5196,8954,6136,8880,7077,8806,9615,8066,9087,4766,9059,4595,9026,4435,8988,4286,fill='#2ba9e1',smooth=1)
canvas.move(item,dx,dy)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(8655,3426,8788,3660,8901,3945,8988,4286,9770,3753,8655,3426,fill='#2b3277')
canvas.move(item,dx,dy)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(7412,5497,7412,5497,4803,4959,4503,6411,4204,7863,6613,8705,7412,5497,fill='#2b3277',smooth=1)
canvas.move(item,dx,dy)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(7915,3385,7932,3541,7852,3678,7735,3691,7618,3705,7509,3589,7491,3433,7473,3278,7554,3140,7671,3127,7788,3114,7897,3229,7915,3385,fill='#2b3277',smooth=1)
canvas.move(item,dx,dy)
canvas.scale(item,0,0,scale,scale)
root.mainloop()
Code: Alles auswählen
import tkinter as tk
root = tk.Tk()
canvas = tk.Canvas(root,width=300,height=350)
canvas.pack()
scale = 0.03
item = canvas.create_polygon(6830,7688,6830,7688,6704,7505,6541,7508,6465,7445,6384,7392,6299,7351,6163,7285,6043,7189,5938,7075,5804,6320,5573,5818,5363,5496,5578,5321,5418,5081,5658,5241,5914,4889,5818,4473,6042,4665,6234,4121,6090,3610,6362,3737,6362,3034,6083,2712,6339,2712,6083,1848,5476,1816,5711,1515,4964,1145,4516,1465,4699,1067,3771,1131,3716,1784,3390,1111,2772,1125,2843,1359,2452,1168,2054,1338,2154,1537,1791,1494,1393,1978,1621,2042,1244,2290,1123,2866,1386,2930,1109,3072,1166,3854,1400,3733,1258,4060,1400,4501,1656,4423,1514,4686,1834,5226,1983,5069,1940,5318,2201,5568,1925,5978,1733,6664,1849,7809,1978,9068,2102,9777,2167,10124,2052,10242,1983,10389,1983,10549,1983,10932,2375,10922,2857,10922,3340,10922,3732,10932,3732,10549,3732,10465,3713,10384,3678,10310,3915,10341,4227,10354,4545,10289,4526,10346,4515,10407,4515,10469,4515,10852,4907,10842,5389,10842,5647,10842,5878,10845,6038,10789,6051,10791,6058,10792,6058,10792,9918,11261,6830,7688,6830,7688,fill='#ffcb09',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(6262,10512,6263,10498,6264,10484,6264,10469,6264,10445,6262,10422,6259,10399,6386,10472,6584,10483,6815,10485,6637,10510,6447,10520,6262,10512,fill='#ffcb09',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(7326,9475,7319,9335,7304,9198,7284,9065,7371,9233,7447,9400,7503,9555,7449,9523,7389,9496,7326,9475,fill='#ffcb09',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(5099,5335,5227,5607,5579,5319,5419,5080,5659,5240,5915,4888,5819,4472,6043,4664,6235,4120,6091,3609,6363,3736,6363,3033,6084,2711,6340,2711,6084,1847,5477,1815,5712,1514,4965,1144,4517,1464,4700,1066,3772,1130,3717,1783,3391,1110,2773,1124,2844,1358,2453,1167,2055,1337,2155,1536,1792,1493,1394,1977,1622,2041,1245,2289,1124,2865,1387,2929,1110,3071,1167,3853,1401,3732,1259,4059,1401,4500,1657,4422,1515,4685,1835,5225,1984,5068,1941,5317,2297,5658,2375,5459,2531,5815,2865,5971,2986,5829,2922,6021,3242,6184,3370,5921,3342,6255,3498,6326,3590,5928,3647,6326,3917,6362,3917,5857,4038,6262,4330,6170,4379,5779,4436,6078,4604,5943,4634,5655,4730,5911,5115,5687,5099,5335,fill='#a26327')
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(4980,4344,4903,4845,4259,5162,3542,5051,2826,4940,2308,4444,2385,3943,2409,3791,2485,3655,2599,3544,2603,3505,2607,3467,2613,3428,2735,2640,3362,2082,4013,2183,4665,2284,5094,3004,4972,3793,4963,3856,4950,3917,4934,3977,4982,4095,4999,4219,4980,4344,fill='#ffcb09',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(3276,10299,3451,10595,3375,10841,3413,10793,3488,10533,3333,10303,3276,10299,fill='#a26327',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(2313,10781,2350,10830,2217,10489,2458,10289,2401,10292,2171,10505,2313,10781,fill='#a26327',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(2835,10306,2835,10306,2920,10547,2827,10821,2827,10821,2889,10879,2907,10597,2926,10304,2814,10215,2835,10306,fill='#a26327',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(3586,3041,3658,3019,3691,2918,3660,2814,3628,2710,3545,2643,3473,2665,3401,2687,3368,2788,3399,2892,3430,2996,3514,3062,3586,3041,fill='#a26327',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(4120,3065,4191,3062,4246,2974,4241,2868,4237,2763,4175,2679,4104,2682,4032,2685,3978,2774,3982,2879,3987,2985,4048,3068,4120,3065,fill='#a26327',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(6831,7687,6831,7687,6705,7504,6542,7507,6922,7821,7182,8390,7285,9064,7537,9552,7703,10031,7522,10224,7522,10201,7522,10177,7520,10148,7506,9854,7368,9785,7413,9871,7413,9871,7491,10051,7489,10254,7409,10318,7287,10373,7141,10415,7139,10384,6979,10176,7083,9850,7015,9883,6941,10170,7129,10417,7130,10417,7131,10418,7132,10418,6826,10506,6415,10540,6057,10493,6049,10299,5941,10162,5895,10160,5975,10280,6006,10397,6019,10487,5821,10457,5641,10401,5508,10315,5513,10264,5519,10232,5519,10232,5533,10172,5495,10190,5472,10289,5263,10133,5192,9888,5393,9528,5990,9151,5889,9029,5650,9178,5824,8845,5741,8780,5602,8722,5421,9034,5573,8680,5234,8665,5244,9080,5194,8884,5061,8904,5108,9430,4905,9799,4913,10069,5023,10267,4964,10343,4899,10515,4941,10718,4975,10762,4939,10537,5042,10298,5141,10453,5303,10561,5469,10635,5491,10787,5527,10747,5527,10747,5519,10716,5514,10684,5510,10652,5786,10766,6060,10791,6060,10791,9919,11260,6831,7687,6831,7687,fill='#a26327',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(5162,2143,5481,2440,5190,2732,4923,2705,4923,2705,4907,2679,4878,2638,5036,2623,5176,2450,4988,2275,4800,2100,4654,2278,4604,2353,4583,2338,4561,2324,4539,2312,4539,2312,4800,1807,5162,2143,fill='#a26327',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(2914,1830,3354,1608,3466,2165,3466,2165,3431,2173,3397,2184,3364,2197,3340,2117,3251,1888,3014,2007,2775,2128,2880,2345,3038,2393,3006,2419,2987,2437,2987,2437,2723,2387,2525,2026,2914,1830,fill='#a26327',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(4275,4480,4270,4530,4224,4593,4126,4617,4023,4642,3881,4647,3795,4453,3795,4453,3753,4177,3771,4050,3825,4034,4016,3951,4081,3809,4152,3651,4095,3644,3729,3601,3363,3558,3665,3981,3665,3981,3665,3981,3717,4033,3746,4048,3742,4094,3737,4226,3769,4453,3769,4453,3753,4647,3568,4660,3348,4674,3289,4535,3284,4503,3278,4471,3266,4499,3266,4499,3266,4499,3262,4702,3565,4693,3731,4688,3785,4517,3785,4517,3785,4517,3872,4673,4047,4662,4315,4646,4299,4454,4299,4454,4299,4454,4281,4430,4275,4480,fill='#a26327',smooth=1)
canvas.scale(item,0,0,scale,scale)
root.mainloop()
Code: Alles auswählen
import tkinter as tk
root = tk.Tk()
canvas = tk.Canvas(root,width=350,height=280)
canvas.pack()
scale = 0.03
item = canvas.create_polygon(11303,6152,11137,6053,11226,6084,11249,6031,11041,5922,11039,5918,11037,5914,11036,5909,10958,5653,10798,4214,10424,3417,10295,3142,10169,3112,10106,3118,10105,3118,9753,2655,9178,2326,8392,2233,8510,1356,8285,808,7207,705,6278,616,5623,1375,5427,1634,5135,1392,4773,1249,4380,1249,4045,1249,3731,1354,3464,1536,3176,1211,2594,704,1825,778,462,908,462,1749,795,3068,795,3068,940,3372,752,3822,575,4244,500,4872,1517,5006,1536,5481,1585,6447,2800,6562,3556,6633,4027,6327,4320,5906,4263,6450,4254,7097,4405,7667,4405,7667,4748,8078,5663,7667,5411,5609,5533,5731,5672,5845,5826,5947,5824,6521,5851,7301,5988,7872,5988,7872,6601,8170,7301,7858,7301,7858,7295,7206,7151,6464,7396,6509,7654,6533,7919,6533,8087,6533,8247,6523,8399,6505,8406,6819,8438,7138,8512,7437,8512,7437,8829,7848,9677,7437,9529,6135,9590,6098,9648,6059,9703,6018,9718,6574,9759,7171,9856,7624,9856,7624,10459,7957,11149,7608,11149,7608,11095,7035,10986,6291,10987,6293,10987,6295,10987,6297,11006,6295,11004,6173,11094,6318,11139,6304,11194,6269,11114,6127,11218,6269,11303,6152,fill='#b19aca',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(2902,5953,2120,5863,2056,5326,2090,5003,2406,4944,2647,4786,2827,4602,2930,4772,3083,4912,3311,5012,3288,5205,3192,5453,2882,5612,2882,5612,2596,5679,2774,5771,2912,5842,3343,5784,3603,5491,3495,5787,3287,5997,2902,5953,fill='#b19aca',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(11302,6153,11137,6053,11226,6084,11249,6032,11041,5922,11039,5919,11037,5915,11036,5910,10958,5653,10798,4215,10424,3418,10295,3143,10169,3113,10106,3119,10168,3200,10222,3285,10270,3374,10271,3373,10275,3382,10280,3392,10285,3401,10324,3478,10359,3558,10389,3640,10662,4339,10861,5434,10987,6297,11006,6296,11004,6174,11094,6318,11139,6305,11194,6270,11114,6128,11218,6270,11302,6153,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(10346,7677,10346,7677,10307,7385,10459,7381,10610,7377,10606,7672,10606,7672,10606,7672,10482,7738,10346,7677,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(10745,7616,10745,7616,10689,7376,10801,7354,10801,7354,10952,7340,10950,7584,10950,7584,10889,7663,10745,7616,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(10222,7635,10222,7635,10247,7367,10133,7362,10133,7362,9986,7363,10013,7593,10013,7593,10068,7662,10222,7635,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(7993,3004,8267,1870,8267,1147,7144,1035,6342,955,5787,1674,5656,1862,5956,2215,6141,2692,6141,3218,6141,3522,6152,3811,6126,4068,6314,4376,6655,4721,7228,4686,8243,4623,8184,4038,8028,3651,7873,3265,7993,3004,7993,3004,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(2773,5772,2912,5843,3342,5785,3602,5492,3643,5380,3669,5255,3685,5127,3542,5099,3418,5060,3310,5013,3287,5206,3191,5454,2881,5613,2881,5613,2595,5680,2773,5772,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(5262,5873,4977,5628,4959,5341,4992,5146,4888,5161,4775,5172,4653,5178,4623,5281,4587,5385,4545,5488,4697,5902,5164,6094,5329,6054,5524,6006,5262,5873,5262,5873,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(3970,2638,3878,2624,3787,2723,3765,2858,3744,2994,3802,3116,3893,3130,3985,3145,4077,3046,4098,2910,4120,2775,4062,2653,3970,2638,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(4771,2702,4680,2670,4567,2751,4520,2884,4473,3017,4510,3151,4602,3183,4695,3216,4807,3134,4854,3001,4901,2868,4864,2734,4771,2702,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(6519,7938,6519,7938,6480,7646,6632,7642,6783,7638,6779,7933,6779,7933,6779,7933,6655,7999,6519,7938,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(6918,7877,6918,7877,6861,7637,6974,7615,6974,7615,7125,7601,7123,7845,7123,7845,7062,7924,6918,7877,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(6395,7896,6395,7896,6420,7628,6306,7623,6306,7623,6159,7624,6186,7854,6186,7854,6241,7923,6395,7896,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(3800,4206,3800,4206,4165,3935,4678,4170,4678,4170,4219,3772,3800,4206,fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
arg1 = [1428,4357,1617,4245,1755,4394,1755,4394,2317,4299,2214,4567,2146,4685,2378,4635,2561,4519,2702,4383,2700,4378,2699,4373,2697,4368,2694,4358,2690,4349,2687,4339,2684,4327,2680,4316,2677,4304,2674,4294,2671,4284,2668,4273,2665,4262,2662,4250,2659,4238,2656,4227,2654,4217,2652,4206,2649,4194,2646,4182,2644,4170,2642,4159,2640,4148,2638,4137,2635,4125,2633,4113,2631,4101,2629,4089,2627,4078,2626,4066,2624,4054,2622,4042,2621,4030,2619,4018,2617,4006,2616,3994,2615,3982,2613,3970,2612,3957,2611,3945,2609,3933,2608,3920,2607,3908,2606,3896,2605,3883,2604,3871,2603,3858,2602,3845,2601,3833,2600,3820,2599,3808,2599,3795,2598,3782,2597,3769,2597,3756,2596,3743,2595,3731,2595,3717,2594,3704,2594,3691,2593,3678,2593,3665,2592,3652,2592,3639,2592,3626,2591,3612,2591,3599,2591,3585,2590,3572,2590,3558,2590,3545,2590,3532,2590,3518,2589,3504,2589,3491,2589,3477,2589,3464,2589,3450,2589,3436,2589,3421,2589,3406,2589,3393,2588,3381,2588,3369,2588,3349,2588,3330,2588,3311,2588,3302,2588,3294,2588,3285,2588,3257,2588,3230,2588,3202,2588,3166,2589,3131,2591,3095,2592,3084,2593,3073,2593,3061,2595,3038,2596]
arg2 = [3014,2599,2990,2600,2977,2602,2964,2603,2951,2606,2929,2608,2907,2611,2886,2613,2873,2615,2860,2618,2847,2621,2825,2625,2804,2629,2783,2631,2770,2634,2758,2637,2745,2641,2724,2646,2702,2651,2681,2654,2669,2657,2658,2660,2646,2666,2624,2672,2602,2679,2580,2682,2570,2685,2560,2688,2549,2696,2526,2704,2502,2712,2479,2715,2471,2717,2463,2720,2455,2730,2428,2741,2401,2752,2374,2754,2370,2755,2367,2756,2364,2823,2206,2908,2060,3008,1929,3009,1928,3009,1927,3010,1926,3029,1901,3049,1877,3070,1853,3071,1852,3072,1850,3073,1849,3093,1825,3114,1802,3136,1779,3136,1778,3137,1777,3138,1776,3160,1753,3183,1730,3206,1708,2947,1438,2485,1080,1888,1137,742,1247,742,1954,1022,3064,1022,3064,1144,3320,986,3698,853,4014,790,4466,1376,4642,1306,4538,1302,4431,1428,4357]
item = canvas.create_polygon(*(arg1+arg2),fill='#662f90',smooth=1)
canvas.scale(item,0,0,scale,scale)
root.mainloop()
Code: Alles auswählen
import tkinter as tk
root = tk.Tk()
canvas = tk.Canvas(root,width=350,height=280)
canvas.pack()
scale = 0.03
item = canvas.create_polygon(7408,4804,6718,3138,6325,3043,6245,3043,5607,709,4471,933,4471,933,3701,956,3238,1863,2960,2981,2904,2975,2507,3005,1789,4741,1077,6460,1535,7342,1618,7479,1618,7479,1634,7509,1647,7508,1660,7507,1681,7468,1681,7468,1724,7415,2237,6768,2581,5790,2535,6610,2545,7201,2545,7202,2545,7202,2578,7587,3877,7696,3629,7850,3282,7938,3282,7938,3443,8231,3725,7962,3392,8315,3593,8509,3890,8143,3742,8380,4005,8486,4154,8321,4348,7985,4456,7723,4512,7724,4569,7724,4628,7724,4759,7724,4882,7722,4997,7718,5073,7968,5194,8269,5334,8425,5628,8332,5569,8097,5788,8458,6067,8269,5734,7916,6016,8185,6177,7892,6177,7892,5861,7811,5616,7670,6667,7536,6667,7196,6667,7196,6668,6740,6659,6318,6641,5926,6984,6863,7473,7479,7515,7531,7515,7531,7536,7570,7549,7571,7562,7571,7578,7542,7578,7542,7662,7405,8119,6523,7408,4804,fill='#010101',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(5039,1445,4724,1426,4626,1703,4601,1737,4576,1770,4547,1720,4547,1720,4547,1720,4194,1319,3786,1615,3174,2060,2388,6997,3192,7300,3926,7577,4681,7535,4681,7535,6225,7535,6292,7199,6292,7199,6435,1477,5039,1445,5039,1445,fill='#ffffff',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(4872,2234,4949,2230,5014,2319,5019,2432,5024,2544,4966,2638,4890,2642,4813,2645,4747,2556,4743,2443,4738,2331,4796,2237,4872,2234,fill='#010101',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(4071,2482,4037,2372,4073,2263,4149,2240,4226,2217,4315,2288,4349,2399,4382,2509,4347,2618,4270,2641,4193,2664,4104,2593,4071,2482,fill='#010101',smooth=1)
canvas.scale(item,0,0,scale,scale)
item = canvas.create_polygon(4965,3769,4965,3769,4443,3563,4235,2961,4235,2961,4658,2787,5044,2921,5044,2921,5186,3294,4965,3769,fill='#010101',smooth=1)
canvas.scale(item,0,0,scale,scale)
root.mainloop()