Popup menu demonstration. : Popup Menu : GUI Tk PYTHON examples


PYTHON examples » GUI Tk » 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""Pink""Gray""Purple"]
      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() )
      
def main():
   PopupMenuDemo().mainloop()   

if __name__ == "__main__":
   main()

           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


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


PYTHON examples

 Navioo GUI Tk
» Popup Menu