[Tutor] Border width of Canvas widget in tkinter

Alok Joshi ajoshi at flash.net
Wed Sep 19 02:44:22 CEST 2012


I am using Python 3.x
 
I am unable to remove the border in a Canvas widget with bd=0 or borderwidth=0. Can someone please explain how one can do this?
 
I give below my program
 
class Avatar(Frame):
    def __init__(self,parent=None,width=100,height=100,ovalness=1,bgFrameColor='Blue',bgCanvasColor='Black'):
        Frame.__init__(self,parent,width=width,height=height,bg=bgFrameColor)
        self.grid()
        #self.grid_propagate(0)
        
        self.width=width
        self.height=height
        self.ovalness=ovalness
        self.bgFrameColor=bgFrameColor
        self.bgCanvasColor=bgCanvasColor
        
        self.canvas1=Canvas(self,width=width/2,height=height/2,bg=bgCanvasColor,borderwidth=0)
        self.canvas1.grid(row=0,column=0,ipadx=0,ipady=0,padx=0,pady=0)
        self.canvas1.grid_propagate(0)
        self.canvas2=Canvas(self,width=width/2,height=height/2,bg=bgCanvasColor,borderwidth=0)
        self.canvas2.grid(row=1,column=1,ipadx=0,ipady=0,padx=0,pady=0)
        self.canvas2.grid_propagate(0)
        
        self.draw()
    def draw(self):
        pass
    
if __name__=='__main__':
    root=Tk()
    x=Avatar(parent=root)
    x.mainloop()
 
when I run this program I can see a gray border on the two canvas objects.
 
Alok
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120918/bcedd6f2/attachment-0001.html>


More information about the Tutor mailing list