1 Replies - 3976 Views - Last Post: 15 June 2012 - 07:21 PM Rate Topic: -----

#1 rosepetalpowder  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 65
  • Joined: 28-February 12

problem - draw line in canvas not binding with button click

Posted 13 June 2012 - 12:01 PM

I got a button to draw a line on canvas. When I click button called lines it should draw line on the canvas. See below code and advise me what i am doing wrong.

self.Canvas1 = Canvas (self.Frame1)
        self.Canvas1.place(relx=0.02,rely=0.02,relheight=0.91,relwidth=0.72)
        self.Canvas1.configure(background="#ffffff")
        self.Canvas1.configure(borderwidth="2")
        self.Canvas1.configure(relief="ridge")
        
        self.Lines = Button (self.Frame1)
        self.Lines.place(relx=0.86,rely=0.04,height=30,width=43)
        self.Lines.configure(background="#999982b02106")
        font13 = "-family Calibri -size 11 -weight bold -slant italic -underline 0 -overstrike 0"
        self.Lines.configure(font=font13)
        self.Lines.configure(pady="0")
        self.Lines.configure(text='''Lines''')
        #self.Lines.configure(command = self.LinesClick)
        self.Lines.bind("<Button-1>", self.LinesClick)   


     def LinesClick(self,event):
        self.Canvas1.create_line(0, 0, 450, 0, width = 5.0, fill="black") 


Is This A Good Question/Topic? 0
  • +

Replies To: problem - draw line in canvas not binding with button click

#2 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: problem - draw line in canvas not binding with button click

Posted 15 June 2012 - 07:21 PM

you'll need to post the code in its entirety for us to help, I can't run this.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1