Question about Tkinter MenuOption variable

Chad slug57_98 at yahoo.com
Thu Apr 19 00:09:29 EDT 2007


Is there anyway to set the individual options in Tkinter to a
particular variable.  For example, I have a menu option(code is below)
which has January, February, March and so on, which I would like to
have corresponding values of 01, 02, 03 and so on.  Can someone please
tell me how to do that within the context of the code I have below -
or even totally modify it if you must.

 Label(self,
              text = "Month"
              ).grid(row = 5, column = 1, sticky = W)
       OPTIONS = [
       "Jan",
       "Feb",
       "Mar",
       "Apr",
       "May",
       "June",
       "July",
       "Aug",
       "Sep",
       "Oct",
       "Nov",
       "Dec"]
       default_option = StringVar(self)
       default_option.set(OPTIONS[0])
       self.month_option = OptionMenu(self, default_option, *OPTIONS)
       self.month_option.grid(row = 5, column = 2, sticky = W)




More information about the Python-list mailing list