Exemple #1
0
    def CreateWidgets(self):
        self.s1 = StringVar()
        self.s2 = StringVar()
        self.v1 = IntVar()
        self.v2 = IntVar()
        self.v3 = IntVar()
        self.v4 = IntVar()
        self.v5 = IntVar()

        self.lf1 = ttk.LabelFrame(self, text="Filename:")
        self.lf1.pack(fill=Tkconstants.BOTH)

        self.lf2 = ttk.LabelFrame(self,
                                  text="Processing choices: pick at least one")
        #       self.lf2.config(label="Processing choices: pick at least one")
        self.lf2.pack(fill=Tkconstants.BOTH)

        self.lf3 = ttk.LabelFrame(self, text="Logging")
        #       self.lf3.config(label="Logging")
        self.lf3.pack(fill=Tkconstants.BOTH)

        self.b1 = Button(self,
                         text="Run",
                         command=self.b1_callback,
                         default=Tkconstants.ACTIVE)
        self.b1.pack(side="bottom")

        self.e1 = Entry(self.lf1, textvariable=self.s1)
        self.e1.pack(fill=Tkconstants.BOTH)
        self.e1.bind("<Button-1>", self.e1_callback)

        self.e2 = Entry(self.lf3, textvariable=self.s2)
        self.e2.pack(fill=Tkconstants.BOTH)

        self.c1 = Checkbutton(self.lf2,
                              text="ET - generate Excel .csv output",
                              variable=self.v1)
        self.c1.pack(anchor=Tkconstants.W)

        self.c2 = Checkbutton(self.lf2,
                              text="HTML - include HTML output from et.py",
                              variable=self.v2)
        self.c2.pack(anchor=Tkconstants.W)

        self.c3 = Checkbutton(self.lf2,
                              text="KML - output for Google Earth",
                              variable=self.v3)
        self.c3.pack(anchor=Tkconstants.W)

        self.c4 = Checkbutton(self.lf2,
                              text="MR - generate a .gpx route file",
                              variable=self.v4)
        self.c4.pack(anchor=Tkconstants.W)

        self.c5 = Checkbutton(self.lf2,
                              text="ROOTER - generate a Rooter file",
                              variable=self.v5)
        self.c5.pack(anchor=Tkconstants.W)
action_warn = lambda: showwarning(WARN, WARN + " pressed")
action_crit = lambda: showerror(CRIT, CRIT + " pressed")
action_regu = lambda: showinfo(REGU, REGU + " pressed")
action_INFO = lambda: showinfo(REGU,
                               "whatever you want,whatever you do,it works!")

top = Tk()
top.iconbitmap('App.ico')

# image = it.PhotoImage(file="GIF2.gif")
Button(top,
       text='chose one to see what may happened',
       command=action_INFO,
       compound='right',
       bg='green',
       fg='white',
       bitmap='info',
       padx=10,
       pady=10).pack()

builderButton = partial(Button, top)
WarnButton = partial(builderButton,
                     command=action_warn,
                     bg='green',
                     fg='white')
CritButton = partial(builderButton, command=action_crit, bg='red', fg='white')
ReguButton = partial(builderButton, command=action_regu, bg='grey', fg='white')

for (key, value) in SIGNS.iteritems():
    cmd = "{0}Button(text='{1}'{2}).pack(fill=X,expand=True)".format(