Canvas paint program. : Canvas : Tkinker PYTHON TUTORIALS


PYTHON TUTORIALS » Tkinker » Canvas »

 

Canvas paint program.


Canvas paint program.
from Tkinter import *

class PaintBoxFrame ):
   def __init__self ):
      Frame.__init__self )
      self.packexpand = YES, fill = BOTH )
      self.master.title"title" )
      self.master.geometry"300x150" )

      self.message = Labelself, text = "Drag the mouse to draw" )
      self.message.packside = BOTTOM )
      
      self.myCanvas = Canvasself )
      self.myCanvas.packexpand = YES, fill = BOTH )

      self.myCanvas.bind"<B1-Motion>", self.paint )

   def paintself, event ):
      x1, y1 = event.x - )event.y - )
      x2, y2 = event.x + )event.y + )
      self.myCanvas.create_ovalx1, y1, x2, y2, fill = "red" )
   
PaintBox().mainloop()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Tkinker
» Canvas