当前位置: 首页>>代码示例>>Python>>正文


Python Frame.destroy方法代码示例

本文整理汇总了Python中Tkinter.Frame.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.destroy方法的具体用法?Python Frame.destroy怎么用?Python Frame.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tkinter.Frame的用法示例。


在下文中一共展示了Frame.destroy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: go_action

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
    def go_action(self, actions):
        """
        execute the action script
        :param actions:
        :return:
        """
        # if EMPTY command then do nothing
        # hide the menu and show a delay screen
        self.hide_top()
        delay = Frame(self, bg="#2d89ef")
        delay.pack(fill=TkC.BOTH, expand=1)
        label = Label(delay, text="Arbetar...", fg="white", bg="#2d89ef", font="Sans 30")
        label.pack(fill=TkC.BOTH, expand=1)
        self.parent.update()
        if  "MATA_UT" in actions:
            self._hwController.do_dispense_on_floor(6)
        if "ON_DEMAND" in actions:
            self._hwController.do_dispense_on_floor(12)

        # excute shell script
        subprocess.call([self.path + '/pimenu.sh'] + actions)

        # remove delay screen and show menu again
        delay.destroy()
        self.destroy_all()
        self.show_top()
开发者ID:senspix,项目名称:medimi,代码行数:28,代码来源:pimenu.py

示例2: mainheader

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
class mainheader():
    def __init__(self, master, console,params,maingui):
        self.frame = Frame(master)
        self.frame.config(padx=5, pady=5, bg=Styles.colours["darkGrey"])
        self.frame.grid(row=0, column=0, sticky=W + E + N + S,columnspan=2)
        self.title = Message(self.frame, text="ProjectB: Selection",
                        justify=CENTER, bg=Styles.colours["darkGrey"],
                        foreground=Styles.colours["yellow"],
                        width=300, font=Styles.fonts["h1"])

        def importsettings(event):
            f = tkFileDialog.askopenfilename(parent=master, title='Choose a file')
            parsemodifycustomvar(params,parsein(f,parseintosimple(params),console))
            maingui.ready("model")
            maingui.ready("bayes")

        def exportfile(event):
            f = tkFileDialog.asksaveasfilename(parent=master, title='Choose a file')
            parseout(f,parseintosimple(params),console)

        self.bimport = camobutton(self.frame, "Import Settings", 15,importsettings)
        self.bexport = camobutton(self.frame, "Export Settings", 15,exportfile)
        self.badvset = yellowbutton(self.frame, "Advanced Settings", 20)

        self.badvset.bind("<Button-1>", lambda a: AdvancedSettings(console,params))
        self.qb = qbutton(self.frame)

        self.title.pack(side=LEFT, fill=BOTH, padx=5, pady=5)
        self.qb.pack(side=RIGHT, fill=BOTH, padx=5, pady=5)
        self.badvset.pack(side=RIGHT, fill=BOTH, padx=5, pady=5)
        self.bexport.pack(side=RIGHT, fill=BOTH, padx=5, pady=5)
        self.bimport.pack(side=RIGHT, fill=BOTH, padx=5, pady=5)

    def destroy(self):
        self.frame.destroy()

    def observationstage(self):
        self.bimport.destroy()
        self.bexport.destroy()
        self.badvset.destroy()
        self.title.config(text="ProjectB: Observation")

    def evaluationstage(self):
        self.title.config(text="ProjectB: Evaluation")
开发者ID:jakedm,项目名称:projectb,代码行数:46,代码来源:header.py

示例3: go_action

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
    def go_action(self, actions):
        """
        execute the action script
        :param actions:
        :return:
        """
        # hide the menu and show a delay screen
        self.hide_top()
        delay = Frame(self, bg="#2d89ef")
        delay.pack(fill=TkC.BOTH, expand=1)
        label = Label(delay, text="Executing...", fg="white", bg="#2d89ef", font="Sans 30")
        label.pack(fill=TkC.BOTH, expand=1)
        self.parent.update()

        # excute shell script
        subprocess.call([self.path + '/pimenu.sh'] + actions)

        # remove delay screen and show menu again
        delay.destroy()
        self.destroy_all()
        self.show_top()
开发者ID:dmpop,项目名称:pimenu,代码行数:23,代码来源:pimenu.py

示例4: startSession

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
    def startSession(self):
        assert TkinterIsInstalled, '''
        Tkinter is not installed. 
        If you have Linux you could try using 
        "apt-get install python-tk"'''
        try:
            import nlopt
        except ImportError:
            s = '''
            To use OpenOpt multifactor analysis tool 
            you should have nlopt with its Python API installed,
            see http://openopt.org/nlopt'''
            print(s)
            showerror('OpenOpt', s)
            raw_input()
            return
        import os
        hd = os.getenv("HOME")
        self.hd = hd
        root = Tk()
        self.root = root
        from openopt import __version__ as oover
        root.wm_title(' OpenOpt %s Multifactor analysis tool for experiment planning ' % oover)
        SessionSelectFrame = Frame(root)
        SessionSelectFrame.pack(side='top', padx=230, ipadx = 40, fill='x', expand=True)
        var = StringVar()
        var.set('asdf')
        Radiobutton(SessionSelectFrame, variable = var, text = 'New', indicatoron=0, \
                    command=lambda: (SessionSelectFrame.destroy(), self.create())).pack(side = 'top', fill='x', pady=5)
        Radiobutton(SessionSelectFrame, variable = var, text = 'Load', indicatoron=0,  \
                    command=lambda:self.load(SessionSelectFrame)).pack(side = 'top', fill='x', pady=5)
        
        root.protocol("WM_DELETE_WINDOW", self.exit)

        root.mainloop()
        self.exit()
开发者ID:AlbertHolmes,项目名称:openopt,代码行数:38,代码来源:mfa.py

示例5: destroy

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
 def destroy(self):
     """overrides toplevel destroy, adding removal from autorefresh panels"""
     if self in topo.guimain.auto_refresh_panels:
         topo.guimain.auto_refresh_panels.remove(self)
     Frame.destroy(self)
开发者ID:a-l-gee,项目名称:topographica,代码行数:7,代码来源:plotgrouppanel.py

示例6: __init__

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
class Game:
    def __init__(self):
        self.root = Tk()
        self.frame1 = None
        self.frame2 = None
        self.w = None
        self.scoreC = None
        self.score = 0
        self.hor = True
        self.upid = self.downid = self.rightid = self.leftid = 0
        self.head = -1
        self.time = 700

    def home(self):
        self.frame1 = Frame(self.root, width=750, height=350, padx=250, bg="black")
        self.frame2 = Frame(self.root, height=250, width=750, bg="black", padx=25)
        self.root.wm_minsize(width=750, height=666)
        self.root.configure(bg="black")
        self.frame1.pack_propagate(0)
        self.frame1.update()
        self.frame1.configure(pady=self.frame1.cget("height") / 2.5)
        logo = PhotoImage(file="Game_Logo.gif")
        starth = Button(self.frame1, text="Hard", bg="orange", padx=25, pady=5,
                        font=Font(family="comic sans MS", size=10),
                        command=lambda: self.callgame(40))
        startm = Button(self.frame1, text="Medium", bg="teal", padx=25, pady=5,
                        font=Font(family="comic sans MS", size=10),
                        command=lambda: self.callgame(60))
        starte = Button(self.frame1, text="Easy", bg="orange", padx=25, pady=5,
                        font=Font(family="comic sans MS", size=10),
                        command=lambda: self.callgame(75))
        self.frame2.pack_propagate(0)
        exp = """        This is a game in which
        the arrow keys are used
        to move the snake around
        and to get points"""
        exf = Font(family="comic sans MS", size=20)
        Label(self.frame2, image=logo, bg="black", text=exp, padx=10).pack(side="right")
        Label(self.frame2, fg="white", bg="black", text=exp, justify="left", font=exf).pack(side="left")
        starte.grid(row=0, columnspan=2)
        startm.grid(row=0, columnspan=2, column=4, padx=18)
        starth.grid(row=0, columnspan=2, column=8)
        head = Font(family="comic sans MS", size=30)
        self.H=Label(self.root, text="SNAKES", font=head, fg="orange", bg="black", pady=10)
        self.H.pack()
        self.frame2.pack(expand=True)
        self.frame1.pack(expand=True)
        self.root.mainloop()

    def callgame(self, time):
        self.time = time
        self.game()

    def calldown(self, key):
        if self.hor:
            self.w.after_cancel(self.leftid)
            self.w.after_cancel(self.rightid)
            self.down(0)

    def callup(self, key):
        if self.hor:
            self.w.after_cancel(self.leftid)
            self.w.after_cancel(self.rightid)
            self.up(0)

    def callright(self, key):
        if not self.hor:
            self.w.after_cancel(self.upid)
            self.w.after_cancel(self.downid)
            self.right(0)

    def callleft(self, key):
        if not self.hor:
            self.w.after_cancel(self.upid)
            self.w.after_cancel(self.downid)
            self.left(0)

    def game(self):
        self.score = 0
        self.w = Canvas(self.root, width=750, height=500, relief="flat", highlightbackground="grey",
                        highlightthickness=10)
        self.frame1.destroy()
        self.frame2.destroy()
        self.root.configure(width=1000, padx=10)
        self.root.pack_propagate(0)
        self.w.configure(background="black")
        self.w.pack(side="left")
        self.w.create_line(300, 250, 450, 250, width=10, fill="teal")
        self.scoreC = Label(self.root, text="Score\n" + str(self.score), bg="black", fg="teal", padx=25, pady=35,
                            font=Font(family="comic sans MS", size=25))
        self.head = self.w.create_line(450, 250, 455, 250, width=10, fill="white")
        self.scoreC.pack(side="top")
        self.root.bind("<Up>", self.callup)
        self.root.bind("<Down>", self.calldown)
        self.root.bind("<Right>", self.callright)
        self.root.bind("<Left>", self.callleft)
        self.createFood()
        self.right(0)

    def down(self, i):
#.........这里部分代码省略.........
开发者ID:abhivijay96,项目名称:Python-snake-game,代码行数:103,代码来源:game.py

示例7: IntroView

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
class IntroView(Frame):
    def __init__(self, controller, parent):     # formerly init_intro_nav():

        '''     using class objects for all these vars now
        global intro_nav, background_frame, can, button_load_game\
            , button_new_game, button_quit, intro_fill_bottom\
            , label_version, title_image_res\
            , intro_top_padding, intro_btm_padding
        '''

        self.controller = controller
        self.parent = parent
        self.app = self.controller.app

        # declare vars

        self.background_frame = 0
        self.intro_nav = 0
        self.intro_top_padding = 0

    def build(self):        # prev: build_intro_nav

        # frame setup
        conf = self.app.conf

        self.background_frame = Frame(self.parent, height=self.parent.sh, width=self.parent.sw
                                      , background=conf.window_background)
        self.intro_nav = Frame(self.background_frame, height=500, width=500
                               , background=conf.intro_background)

        # elements

        self.intro_top_padding = Canvas(self.intro_nav)
        self.intro_top_padding.configure(height=conf.intro_padding_height
                                         , background=conf.intro_background
                                         , highlightbackground=conf.intro_background)

        self.title_image_resource = Image.open(conf.title_image_path)
        self.title_image_res = ImageTk.PhotoImage(self.title_image_resource)
        self.can = Canvas(self.intro_nav, background=conf.intro_background
                          , highlightbackground=conf.intro_background)
        self.can.title_image_res = self.title_image_res
        self.can.config(width=self.title_image_res.width(), height=self.title_image_res.height())

        self.button_new_game = Button(self.intro_nav, text="New Game"
                                      , command=self.controller.event_button_new_game
                                      , bg=conf.intro_background)
        self.button_new_game.config(highlightbackground=conf.intro_background)

        self.button_load_game = Button(self.intro_nav, text="Load Game"
                                       , command=self.controller.event_button_load_game
                                       , bg=conf.intro_background)
        self.button_load_game.config(highlightbackground=conf.intro_background)
        self.button_load_game.config(state='disabled')

        self.button_quit = Button(self.intro_nav, text="Quit"
                                  , command=self.controller.event_button_quit
                                  , bg=conf.intro_background)
        self.button_quit.config(highlightbackground=conf.intro_background)

        self.label_version = Label(self.intro_nav, bg=conf.intro_background, text=conf.version)

        self.intro_btm_padding = Canvas(self.intro_nav)
        self.intro_btm_padding.configure(height=conf.intro_padding_height
                                         , background=conf.intro_background
                                         , highlightbackground=conf.intro_background)

    def hide(self):     # formerly hide_intro_nav
        self.intro_nav.destroy()
        self.background_frame.destroy()
        self.can.destroy()
        self.button_load_game.destroy()
        self.button_new_game.destroy()
        self.button_quit.destroy()
        self.label_version.destroy()
        self.title_image_res.__del__()
        self.intro_top_padding.destroy()
        self.intro_btm_padding.destroy()


    def draw(self):       # formerly draw_intro_nav()

        # frame setup

        self.intro_top_padding.pack()

        self.background_frame.pack(fill='both')
        self.intro_nav.pack(fill='both', padx=(self.parent.sw/2)-250, pady=(self.parent.sh/2)-250)

        self.app.debug(("Drew Intro, padding: (", (self.parent.sw/2)-250, ",", (self.parent.sh/2)-250, ")"))

        # elements

        self.can.pack(fill='both', side='top', padx=50, pady=50)
        self.can.create_image(2, 2, image=self.title_image_res, anchor='nw')

        self.button_new_game.pack(fill="x", padx=50)
        self.button_load_game.pack(fill="x", padx=50)
        self.button_quit.pack(fill="x", padx=50)
        self.label_version.pack(fill='y', padx=10, pady=10)
#.........这里部分代码省略.........
开发者ID:dangeratio,项目名称:spacewars,代码行数:103,代码来源:intro_view.py

示例8: destroy

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
    def destroy(self):
	Publisher.Destroy(self)
	Frame.destroy(self)
开发者ID:shumik,项目名称:skencil-c,代码行数:5,代码来源:filldlg.py

示例9: OfxConverter

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]

#.........这里部分代码省略.........
        notebook.add( tabLogging, text=u"Logging" )

        notebook.pack(fill=constants.BOTH,expand=1,anchor=constants.N)

        self.tabFiles.grid_columnconfigure( 0, weight=1 ) 

    def addFile(self,filename,ibans):
        if filename != u"" and len(ibans) > 0:
            Label(self.tabFiles, text=filename,
                    borderwidth=3).grid(row=self.row,column=0,sticky=constants.W,padx=1)
            
            ibanList = []
            for iban in ibans:
                ibanList.append( iban[:8] )
            combo = ttk.Combobox(self.tabFiles,values=ibanList)
            combo.current(0)
            if len(ibanList) == 1:
                combo.configure(state=constants.DISABLED)
            combo.grid(row=self.row,column=1,sticky=constants.E,padx=1)
            
            state = IntVar()
            c = Checkbutton(self.tabFiles,variable=state)
            c.grid(row=self.row,column=2)
            self.row += 1
            ttk.Separator(self.tabFiles).grid(row=self.row, sticky=u"ew", columnspan=3 )
            self.row += 1
            self.guiMap.append( [ filename, ibans, combo, c, state ] )

    def addFileToCustomTab(self,filename):
        if filename != u"":

            if self.frame:
                self.frame.pack_forget()
                self.frame.destroy()
            self.frame = Frame( self.canvas )
            self.canvas.create_window((0,0),window=self.frame,anchor=u'nw')
            self.frame.bind(u"<Configure>", self.onFrameConfigure)
             
            file = csv.reader( open(filename) )
            lines = 1

            transaction = Transaction()
            fields = transaction.fields
            fields.insert(0,u"main account")
            fields.insert(0,self.UNUSED)

            self.comboBoxes = []
            self.labels = collections.defaultdict(list)
            
            for row in file:
                column = 0
                for field in row:
                    if lines == 1:
                        combo = ttk.Combobox(self.frame,values=transaction.fields,state=u"readonly")
                        combo.current(0)
                        combo.grid(row=0,column=column,sticky=constants.W)
                        self.comboBoxes.append( combo )
                        combo.bind(u'<<ComboboxSelected>>', self.onComboboxChanged)
                        nextColumn = column + 1
                        ttk.Separator(self.frame,orient=constants.VERTICAL).grid(row=0, column=nextColumn, sticky=u"ns")
                            
                    label = Label(self.frame,text=field,borderwidth=3)
                    label.grid(row=lines,column=column,sticky=constants.W,padx=1)
                    self.labels[lines-1].append( label )
                    column = column + 1
                    ttk.Separator(self.frame,orient=constants.VERTICAL).grid(row=lines, column=column, sticky=u"ns")
开发者ID:weirdall,项目名称:ofxconverter,代码行数:70,代码来源:main.py

示例10: ProjectArea

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
class ProjectArea(object):
    '''Main area for note taking and skimming. Also has time button.'''
    def __init__(self, parent, title, tcmd):
        self.remove = parent.rproject   #Remove function
        self.move = parent.move         #Move function
        self.nc = parent.nc
        self.title = title
        self.tcmd = tcmd #passed in from timehandler
        self.lock = 0
        self.going = parent.going
        self.stopped = parent.stopped
        self.pdate = None
        self.f = Frame(parent.f, relief=RAISED, borderwidth=2)
        f2 = Frame(self.f)
        f2.pack()
        l = Label(f2, text=title, width=42, font=("Helvetica", 16))
        l.pack(side=LEFT)
        l.bind("<Button-1>", self._click)
        self.b = Button(f2, image=self.stopped, command=self._timer)
        self.b.pack(side=LEFT)
        Button(f2, text='X', command=self.close).pack(side=LEFT)
        self.prev()
        self.entry = Text(self.f1, width=80, height=10, bg='white', wrap=WORD)
        self.entry.bind("<Shift-Key-Return>", self.commit_note)
        self.entry.bind("<Control-Key-Return>", self.p.gui_refresh)
        self.f.pack()

    def prev(self):
        self.f1 = Frame(self.f)
        self.days = Days(master=self.f1, ncore=self.nc, project=self.title)
        self.p = self.days.get_current()

    def _click(self, event=None):
        self.move(title=self.title)

    def ent(self):
        self.f1.pack()
        self.entry.pack()
        self.entry.focus_set()

    def lv(self):
        if self.lock == 0:
            self.f1.pack_forget()
            self.entry.pack_forget()

    def commit_note(self, event=None, initial=None):
        if initial is not None:
            s = "Open"
        else:
            s = self.entry.get('1.0', END).strip()
        # Does not commit empty notes.
        if s == "":
            return
        t = datetime.datetime.now() #time
        d = int(t.strftime("%Y%m%d"))
        t = int(t.strftime("%H%M"))
        self.nc.note_in(self.title, s, d, t)
        self.entry.delete('0.0', END)
        self.entry.mark_set("insert", "%d.%d" % (1, 0))
        if d == self.p.date:
            self.p.gui_refresh()
        else:
            self.days.append(d)
            self.p = self.days.get_current()

    def _timer(self):
        """
        Timer button. Calls tcmd to start or stop the timer.
        Switches the images.
        """
        temp = self.tcmd()
        if temp:
            self.b.config(image=self.going)
        else:
            self.b.config(image=self.stopped)
        self.b.pack()

    def close(self):
        self.tcmd(close=1) #stops the timer when closing.
        self.remove(self.title)
        self.nc.archive_project(self.title)
        self.f.pack_forget()
        self.f.destroy()
开发者ID:Ghalko,项目名称:noteTaker,代码行数:85,代码来源:notes.py

示例11: destroy

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
 def destroy(self):
     self.running = False
     return Frame.destroy(self)
开发者ID:ladsmund,项目名称:msp_group_project,代码行数:5,代码来源:keyboard.py

示例12: destroy

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
 def destroy(self):
     for event, ids in self.callback_ids.iteritems():
         for id in ids:
             self.parent.unbind(event, id)
     Frame.destroy(self)
开发者ID:kms70847,项目名称:Falling-Block-Game,代码行数:7,代码来源:stage.py

示例13: ModelBayes

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
class ModelBayes():
    def __init__(self, master, console, params, row, col, maingui):
        self.frame = Frame(master)
        self.maingui = maingui
        self.frame.config(padx=20, pady=20, bg=Styles.colours["grey"])
        self.frame.grid(row=row, column=col, sticky=NW)
        self.console = console
        self.params = params
        self.headerbayes()
        self.policy()
        self.kernels()
        self.iterations()
        self.minormax()
        self.outputdir()

    def destroy(self):
        self.frame.destroy()

    def headerbayes(self):
        headerbayes = header(self.frame, "Set the Bayesian Optimization Parameters")
        headerbayes.config(width=400)
        headerbayes.grid(row=0, column=0, sticky=W, columnspan=2)

    def policy(self):
        policyheader = headersmall(self.frame, text="Policies:")
        cei = Checkbutton(self.frame, text="Expected Improvement", variable=self.params["policies"][0], bg=Styles.colours["grey"])
        cpi = Checkbutton(self.frame, text="Probability Improvement", variable=self.params["policies"][1], bg=Styles.colours["grey"])
        cucb = Checkbutton(self.frame, text="Upper Confidence Bound", variable=self.params["policies"][2], bg=Styles.colours["grey"])
        ctho = Checkbutton(self.frame, text="Thompson", variable=self.params["policies"][3], bg=Styles.colours["grey"])

        self.isreadyR(cei)
        self.isreadyR(cpi)
        self.isreadyR(cucb)
        self.isreadyR(ctho)

        policyheader.grid(row=1, column=0, sticky=W, columnspan=1)
        cei.grid(row=2, column=0, pady=0, sticky=W, padx=10, columnspan=1)
        cpi.grid(row=3, column=0, pady=0, sticky=W, padx=10, columnspan=1)
        cucb.grid(row=4, column=0, pady=0, sticky=W, padx=10, columnspan=1)
        ctho.grid(row=5, column=0, pady=0, sticky=W, padx=10, columnspan=1)

    def kernels(self):
        kernelsheader = headersmall(self.frame, text="Kernels:")

        cse = Checkbutton(self.frame, text="Squared Exponential", variable=self.params["kernels"][0], bg=Styles.colours["grey"])
        cm5 = Checkbutton(self.frame, text="Matern 5", variable=self.params["kernels"][1], bg=Styles.colours["grey"])
        cm3 = Checkbutton(self.frame, text="Matern 3", variable=self.params["kernels"][2], bg=Styles.colours["grey"])
        cm1 = Checkbutton(self.frame, text="Matern 1", variable=self.params["kernels"][3], bg=Styles.colours["grey"])

        self.isreadyR(cse)
        self.isreadyR(cm5)
        self.isreadyR(cm3)
        self.isreadyR(cm1)

        kernelsheader.grid(row=1, column=1, sticky=W, columnspan=2)
        cse.grid(row=2, column=1, pady=0, sticky=W, padx=10, columnspan=1)
        cm5.grid(row=3, column=1, pady=0, sticky=W, padx=10, columnspan=1)
        cm3.grid(row=4, column=1, pady=0, sticky=W, padx=10, columnspan=1)
        cm1.grid(row=5, column=1, pady=0, sticky=W, padx=10, columnspan=1)

        Label(self.frame, text="", font=("Arial", 6)).grid(row=6, column=0, sticky=W, columnspan=2)

    def iterations(self):
        iterheader = headersmall(self.frame, "Iterations:")
        e = smallentry(self.frame, self.params["iter"], 10, True)
        iterheader.grid(row=7, column=0, sticky=W, columnspan=1)
        self.isreadyR(e, "<FocusOut>")
        e.grid(row=8, column=0, sticky=W, padx=25)

    def minormax(self):
        objheader = headersmall(self.frame, text="Objective:")

        rmim = Radiobutton(self.frame, text="Minimize", variable=self.params["objective"], value="min", bg=Styles.colours["grey"])
        rmax = Radiobutton(self.frame, text="Maximize", variable=self.params["objective"], value="max", bg=Styles.colours["grey"])

        objheader.grid(row=7, column=1, sticky=W, columnspan=2)
        rmim.grid(row=8, column=1, pady=0, sticky=W, padx=10)
        rmax.grid(row=9, column=1, pady=0, sticky=W, padx=10)

        # Label(self.frame, text="", font=("Arial", 12)).grid(row=10, column=0, sticky=W, columnspan=2)

    def outputdir(self):
        iframe = Frame(self.frame)
        iframe.config(padx=5, pady=5, bg=Styles.colours["grey"])
        iframe.grid(row=10, column=0, sticky=W + E + N + S, columnspan=3, rowspan=2)
        objheader = headersmall(iframe, text="Model Output Directory (Optional):")
        boutfile = yellowbutton(iframe, "Select Directory", 14, click=None)
        eoutfiledir = entry(iframe, self.params["outputdir"], 32, fileCheck=False, dir=True, button=boutfile)
        objheader.grid(row=0, column=0, sticky=W, columnspan=2)
        boutfile.grid(row=1, column=2, pady=5)
        eoutfiledir.grid(row=1, column=0, columnspan=2)

    def isreadyR(self, r, e=None):
        def check():
            if self.checkall():
                self.maingui.ready("bayes")
            else:
                self.maingui.notready("bayes")

        if e is None:
#.........这里部分代码省略.........
开发者ID:jakedm,项目名称:projectb,代码行数:103,代码来源:selection.py

示例14: ModelFrame

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
class ModelFrame():
    def __init__(self, master, console, params, row, col, maingui):
        self.frame = Frame(master)
        self.maingui = maingui
        self.frame.config(padx=20, pady=20, bg=Styles.colours["grey"])
        self.frame.grid(row=row, column=col, sticky=NW)
        self.console = console
        self.params = params
        self.modelparamslist = ["command", "modelinput", "modeloutput", "bounds"]
        self.paramsdefaults = dict(
            (k, self.params[k].get if type(self.params[k]) is not list else []) for k in self.modelparamslist)
        self.headermodel()
        self.modelcmd()
        self.modelio()
        self.bounds()

    def destroy(self):
        self.frame.destroy()

    def headermodel(self):
        headermodel = header(self.frame, "Model Parameters")
        headermodel.grid(row=0, column=0, sticky=W, columnspan=2)

    def modelcmd(self):
        cmdheader = headersmall(self.frame, "Commandline command for the model:")
        ecmd = entry(self.frame, self.params["command"], 65, file=False, fileCheck=False, button=None)

        cmdheader.grid(row=1, column=0, sticky=W, columnspan=2)
        ecmd.grid(row=2, column=0, columnspan=3, pady=5, rowspan=2)
        self.isreadyE(ecmd)
        # Seperator
        Label(self.frame, text="", bg=Styles.colours["grey"]).grid(row=4, column=0, sticky=W, columnspan=2)

    def modelio(self):
        ioheader = header(self.frame, "Select your model I/O:")

        biuri = yellowbutton(self.frame, "Select Input File", 20, click=None)
        bouri = yellowbutton(self.frame, "Select Output File", 20, click=None)
        eiuri = entry(self.frame, self.params["modelinput"], 40, file=True, fileCheck=True, button=biuri)
        eouri = entry(self.frame, self.params["modeloutput"], 40, file=True, fileCheck=True, button=bouri)
        self.isreadyB(biuri)
        self.isreadyB(bouri)
        self.isreadyE(eiuri)
        self.isreadyE(eouri)
        ioheader.grid(row=5, column=0, sticky=W, columnspan=2)
        biuri.grid(row=6, column=2, pady=5)
        bouri.grid(row=7, column=2, pady=5)
        eiuri.grid(row=6, column=0, columnspan=2)
        eouri.grid(row=7, column=0, columnspan=2)
        # Seperator
        Label(self.frame, text="", bg=Styles.colours["grey"]).grid(row=8, column=0, sticky=W, columnspan=2)

    def bounds(self):
        def boundsfilepicker(event):
            f = tkFileDialog.askopenfilename(parent=self.frame, title='Choose bounds a file')

            if os.path.isfile(f):
                try:
                    bounds = genfromtxt(f, delimiter=",")
                    if ((bounds.shape[1] == 2 and (bounds[:, 0] < bounds[:, 1]).all())):
                        self.params["bounds"] = bounds
                        self.console.log("Bounds set to a file: " + str(f))
                        self.console.log("You can now view the bounds")
                        bboundsf.bind("<Enter>", lambda event: "break")
                        bboundsf.bind("<FocusIn>", lambda event: "break")
                        bboundsf.bind("<Leave>", lambda event: "break")
                        bboundsf.bind("<FocusOut>", lambda event: "break")
                    else:
                        texterror = "Bounds file has wrong dimensions, please check the file"
                        self.console.log(texterror)
                        popupwindow("Bounds File error", 2, texterror)
                except:
                    texterror = "Bounds file has wrong format, please check the file"
                    self.console.log(texterror)
                    popupwindow("Bounds File error", 2, texterror)
            else:
                texterror = "Bounds file has not been selected, please select the file"
                self.console.log(texterror)
                popupwindow("Bounds File error", 2, texterror)

        def helpbounds(evemt):
            helpboundsw = Toplevel()
            helpboundsw.title("Help: Bounds")
            helpboundsw.config(bg=Styles.colours["grey"], padx=10, pady=10)

            boundswindowheader = header(helpboundsw, "How to set bounds?")
            t = Text(helpboundsw, width=30, height=20, relief=FLAT, bg=Styles.colours["grey"], wrap=WORD,
                     font=Styles.fonts["entryFilled"])
            t.insert(END,
                     " The bounds give the model maximum and minimum for each input parameter value. You can set the bounds from a file in CSV file"
                     "where first column is the minimum and second column is the maximum, or through the window presented prior.")
            boundswindowheader.grid(row=0, column=0)
            t.grid(row=1, column=0)

        def manualbounds(event):
            def checkbounds(event):
                try:
                    b = minmaxT.get(1.0, END)
                    bounds = array([fromstring(x, dtype=float, sep="-") for x in b.replace(" ", "").split()])
                    if (bounds.shape[1] == 2 and (bounds[:, 0] < bounds[:, 1]).all()):
#.........这里部分代码省略.........
开发者ID:jakedm,项目名称:projectb,代码行数:103,代码来源:selection.py

示例15: __init__

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import destroy [as 别名]
class Menu:

    def __init__(self, master):
        '''Main Menu container Items'''
        self.MainMenuContainer = Frame(master)
        self.MainButtonContainer = Frame(master)
        self.MenuFourContainer = Frame(master)
        self.MenufourYearsContainer = Frame(master)
        root.title(main_title)
        self.initUI()

    def initUI(self):
        
        self.image('MainPic.jpg')
        Label(self.MainMenuContainer, 
              text=main_title,
              font=15,
              padx=10,
              pady=10).pack()
        self.MainMenuContainer.pack(
            fill=BOTH, expand=1)
        self.MainButtonContainer.pack()
        self.MenufourYearsContainer.pack() 
        Label(self.MainMenuContainer, 
		      text=dates.date()).pack()
        CommandOfMainButtons = [
            self.menu_one,
            self.menu_two,
            self.menu_three,
            self.menu_four,
            self.menu_five,
            ]
        ButtonCreator(self.MainButtonContainer, 
                          ListOfMainButtons,
                          CommandOfMainButtons, 5)

      

#  **************SUB MENU METHODS***************

    def menu_one(self):
        run.menuone()

    def menu_two(self):
        os.chdir (PATH + '//' + str(dates.actualyear()))
        File = Month = dates.actualmonth(months)
        run.showdata(
		    Month.title() + 
		    ' honap idoadatai', File,
            ' \nLedolgozott napok szama: \t%s')

    def menu_three(self):
        messagebox.yesorno()

    def menu_four(self):
        self.destroy_mainbutton()
        self.menufour()

    def menu_five(self):
        root.destroy()

          
    def quit_menutwo(self):
        self.f4.destroy()

    def quit_menuone(self):
        self.MenuOneContainer.destroy()

    def quit_menufour(self):
        os.chdir(PATH) 
        self.MainMenuContainer.destroy()
        self.MenufourYearsContainer.destroy()
        run = Menu(root)

    def act(self, Month):
        File = Month
        run.showdata(
            Month.title() + ' honap idoadatai',
			File,'\nLedolgozott napok szama : \t%s')

    def setdata(self, data):
        data = int(data.get())
        return data

    def destroy_mainbutton(self):
        self.MainButtonContainer.destroy()

#  **************MENU METHODS***************

    def menuone(self):
        '''Menu one waiting for user input and store the data'''
        Ido = Tk()
        self.MenuOneContainer = Ido
        Label(self.MenuOneContainer,
              text=menuone_button1_title).grid(row=4, sticky=W)
        Label(self.MenuOneContainer,
              text=menuone_button2_title).grid(row=5, sticky=W)
        Label(self.MenuOneContainer,
              text=menuone_button3_title).grid(row=6, sticky=W)
        Label(self.MenuOneContainer,
#.........这里部分代码省略.........
开发者ID:DavidJohnson86,项目名称:Work_Time_Management,代码行数:103,代码来源:Work_Time.py


注:本文中的Tkinter.Frame.destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。