+ 7

Why this code does not draw a window on a python shell?

global winup, win2up class MyUtils(): def showRoundRect(self,can,x,y,width,heigh,rad): can.create_arc(x,y+rad*2,x+rad*2,y,start=90, extent=90,style=ARC) can.create_line(x+rad.y,x+width-rad.y) can.create_arc (x+width-rad*2,y+rad*2,x+width,y, start=0,extent=90, style=ARC) can.create_line(x+width,y+rad,x+width,x+width,y+height-rad) can.create_arc(x+width-rad*2,y+height,x+width,y+height-rad*2,start=270,extent=90, style=ARC) can.create_line(width-rad,y+height,x+rad,y+hieght) can.create_arc(x,y+height,x+rad*2,y+height-rad*2,start=180, extent=90,style=ARC) can.create_line(x,y+height-rad,x,y+rad) def clearRect(self, can,x,y,width,height,rad): can.create_rectangle(x-2,y-2,x+width+rad+4, y+height+rad+4, fill="white", width=0) class myButton(): def __init_

27th Jan 2019, 6:11 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
5 Answers
+ 4
What's that? For the most part, that doesn't even seem to be valid python code. There are several references to unintroduced variables, beginning a code with "global" is rather unusual (is there something missing at the beginning?) and the code just ends in the middle of an arbitrary line
27th Jan 2019, 7:20 AM
Anna
Anna - avatar
+ 6
There is from Tkinter import * in the beginning
27th Jan 2019, 10:29 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 6
What I wanted is to make rounded rectangular buttons
27th Jan 2019, 10:30 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 4
Zhenis Otarbay Are you sure that this is python 3 code? I have no idea about python 2, but in python 3 it doesn't really make sense to begin a code with the "global" keyword. To me it looks like a failed attempt at declaring a global variable, which is not the way things work in python 3. If I remember correctly, the name of the module is Tkinter in python 2 and tkinter (not capitalized) in python 3 so that would make sense
27th Jan 2019, 11:08 AM
Anna
Anna - avatar