Popup menu demonstration. : Popup menu : Tkinker PYTHON TUTORIALS


PYTHON TUTORIALS » Tkinker » Popup menu »

 

Popup menu demonstration.


Popup menu demonstration.
from Tkinter import *

class PopupMenuDemoFrame ):
   def __init__self ):
      Frame.__init__self )
      self.packexpand = YES, fill = BOTH )
      self.master.title"Popup Menu Demo" )
      self.master.geometry"300x200" )

      self.frame1 = Frameself, bg = "white" )
      self.frame1.packexpand= YES, fill = BOTH )
      
      self.menu = Menuself.frame1, tearoff = )

      colors = "White""Blue""Yellow""Red" ]
      self.selectedColor = StringVar()
      self.selectedColor.setcolors] )
      
      for item in colors:
         self.menu.add_radiobuttonlabel = item,
            variable = self.selectedColor,
            command = self.changeBackgroundColor )

      self.frame1.bind"<Button-3>", self.popUpMenu )

   def popUpMenuself, event ):
      self.menu.postevent.x_root, event.y_root )

   def changeBackgroundColorself ):
      self.frame1.configbg = self.selectedColor.get() )
      
PopupMenuDemo().mainloop()



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Tkinker
» Popup menu