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


Python Notebook.grid方法代码示例

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


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

示例1: NewActionModulation

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
class NewActionModulation(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()

    def initUI(self):
        self.parent.title("Test")
        self.frameTab = Frame(self, relief=RAISED, borderwidth=1)
        self.frameTab.grid(row=3, column=0, columnspan=4)
        self.grid(row=0, column=0)
        self.frameTab.grid(row=0, column=0)
        self.note_book = Notebook(self.frameTab)
        self.specific_actions = ActionModulation.ActionModulation(self.note_book)
        self.note_book.add(self.specific_actions.getFrame(), text="specific actions")
        self.general_actions = GeneralActionModulation.GeneralActionModulation(self.note_book)
        self.note_book.add(self.general_actions.getFrame(), text="general actions")
        self.note_book.grid(row=0, column=0)

        self.frameButtons = Frame(self, relief=RAISED, borderwidth=1)
        self.frameButtons.grid(row=3, column=0, columnspan=4)
        self.buttonReset = Button(self.frameButtons, text="Reset")
        self.buttonReset.grid(row=0, column=0)
        self.buttonAbort = Button(self.frameButtons, text="Abort")
        self.buttonAbort.grid(row=0, column=1)
        self.buttonStop = Button(self.frameButtons, text="Stop")
        self.buttonStop.grid(row=0, column=2)
        self.buttonSendAction = Button(self.frameButtons, text="Send Action")
        self.buttonSendAction.grid(row=0, column=4)
        self.buttonSendEmotion = Button(self.frameButtons, text="Send Emotion")
        self.buttonSendEmotion.grid(row=0, column=5)

    def getCurrentTab(self):
        return self.note_book.index(self.note_book.select())

    def getFirstTab(self):
        return self.specific_actions

    def getSecondTab(self):
        return self.general_actions

    def getButtonSendAction(self):
        return self.buttonSendAction

    def getButtonSendEmotion(self):
        return self.buttonSendEmotion

    def getButtonReset(self):
        return self.buttonReset

    def getButtonAbort(self):
        return self.buttonAbort

    def getButtonStop(self):
        return self.buttonStop
开发者ID:julianangel,项目名称:EmotionBot,代码行数:57,代码来源:NewActionModulation.py

示例2: _create_panel

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
 def _create_panel(self):
     
     panel = Frame(self, name='elastic')
     #panel.pack(side=TOP, fill=BOTH, expand=Y)
     panel.grid(row=0, column=0, sticky=NSEW) 
     nb = Notebook(panel, name='notebook')
     
     nb.enable_traversal()
     #nb.pack(fill=BOTH, expand=Y, padx=2, pady=3)
     nb.grid(row=0, column=0, sticky=NSEW)
     self._create_setup_tab(nb)
     self._create_analyze_tab(nb)
开发者ID:tdengg,项目名称:pylastic,代码行数:14,代码来源:main.py

示例3: __init__

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
class GUI:

    ## GUI variables
    titleText = 'PyCX Simulator'  # window title
    timeInterval = 0              # refresh time in milliseconds
    running = False
    modelFigure = None
    stepSize = 1
    currentStep = 0
    def __init__(self,title='PyCX Simulator',interval=0,stepSize=1,parameterSetters=[]):
        self.titleText = title
        self.timeInterval = interval
        self.stepSize = stepSize
        self.parameterSetters = parameterSetters
        self.varEntries = {}
        self.statusStr = ""
               
        self.initGUI()
    def initGUI(self):
        #create root window
        self.rootWindow = Tk()
        self.statusText = StringVar(value=self.statusStr) 
        self.setStatusStr("Simulation not yet started")

        self.rootWindow.wm_title(self.titleText)
        self.rootWindow.protocol('WM_DELETE_WINDOW',self.quitGUI)
        self.rootWindow.geometry('550x400')
        self.rootWindow.columnconfigure(0, weight=1)
        self.rootWindow.rowconfigure(0, weight=1)
        
        self.notebook = Notebook(self.rootWindow)      
        self.notebook.grid(row=0,column=0,padx=2,pady=2,sticky='nswe')
        

        self.frameRun = Frame()
        self.frameSettings = Frame()
        self.frameParameters = Frame()
        self.frameInformation = Frame()          
        
        self.notebook.add(self.frameRun,text="Run")
        self.notebook.add(self.frameSettings,text="Settings")
        self.notebook.add(self.frameParameters,text="Parameters")
        self.notebook.add(self.frameInformation,text="Info")
     
        self.notebook.pack(expand=YES, fill=BOTH, padx=5, pady=5 ,side=TOP)
        self.status = Label(self.rootWindow, width=40,height=3, relief=SUNKEN, bd=1,textvariable=self.statusText)
        self.status.grid(row=1,column=0,padx=2,pady=2,sticky='nswe')
        self.status.pack(side=TOP, fill=X, padx=1, pady=1, expand=NO)



        
        self.runPauseString = StringVar()
        self.runPauseString.set("Run")
        self.buttonRun = Button(self.frameRun,width=30,height=2,textvariable=self.runPauseString,command=self.runEvent)
        self.buttonRun.pack(side=TOP, padx=5, pady=5)



        self.showHelp(self.buttonRun,"Runs the simulation (or pauses the running simulation)")
        self.buttonStep = Button(self.frameRun,width=30,height=2,text='Step Once',command=self.stepOnce)
        self.buttonStep.pack(side=TOP, padx=5, pady=5)
        self.showHelp(self.buttonStep,"Steps the simulation only once")
        self.buttonReset = Button(self.frameRun,width=30,height=2,text='Reset',command=self.resetModel)
        self.buttonReset.pack(side=TOP, padx=5, pady=5) 
        self.showHelp(self.buttonReset,"Resets the simulation")
 
   
        
        can = Canvas(self.frameSettings)
        lab = Label(can, width=25,height=1,text="Step size ", justify=LEFT, anchor=W,takefocus=0)
        lab.pack(side='left')
        self.stepScale = Scale(can,from_=1, to=50, resolution=1,command=self.changeStepSize,orient=HORIZONTAL, width=25,length=150)
        self.stepScale.set(self.stepSize)
        self.showHelp(self.stepScale,"Skips model redraw during every [n] simulation steps\nResults in a faster model run.")
        self.stepScale.pack(side='left')    
        can.pack(side='top')
    
        can = Canvas(self.frameSettings)
        lab = Label(can, width=25,height=1,text="Step visualization delay in ms ", justify=LEFT, anchor=W,takefocus=0)
        lab.pack(side='left')
        self.stepDelay = Scale(can,from_=0, to=max(2000,self.timeInterval), resolution=10,command=self.changeStepDelay,orient=HORIZONTAL, width=25,length=150)
        self.stepDelay.set(self.timeInterval)
        self.showHelp(self.stepDelay,"The visualization of each step is delays by the given number of milliseconds.")
        self.stepDelay.pack(side='left')    
        can.pack(side='top')
        scrollInfo = Scrollbar(self.frameInformation)
        self.textInformation = Text(self.frameInformation, width=45,height=13,bg='lightgray',wrap=WORD,font=("Courier",10))
        scrollInfo.pack(side=RIGHT, fill=Y)
        self.textInformation.pack(side=LEFT,fill=BOTH,expand=YES)
        scrollInfo.config(command=self.textInformation.yview)
        self.textInformation.config(yscrollcommand=scrollInfo.set)
        for variableSetter in self.parameterSetters:
            can = Canvas(self.frameParameters)
            lab = Label(can, width=25,height=1,text=variableSetter.__name__+" ",anchor=W,takefocus=0)
            lab.pack(side='left')
            ent = Entry(can, width=11)
            ent.insert(0, str(variableSetter()))
            if variableSetter.__doc__ != None and len(variableSetter.__doc__) > 0:
                self.showHelp(ent,variableSetter.__doc__.strip())
#.........这里部分代码省略.........
开发者ID:joh,项目名称:cxboids,代码行数:103,代码来源:pycxsimulator.py

示例4: Application

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
class Application(Frame):
    def __init__(self, master):
        Frame.__init__(self, master)
        self.FileObjects = []
        self.FileObjectNames = []
        self.intSettings = {'Group': IntVar(value=1),
                            'DataObject': IntVar(value=1),
                            'FieldVariables': IntVar(value=1)}

        self.FieldVariables = OrderedDict()

        self.notebook = Notebook(self)
        self.tab1 = Frame(self.notebook)
        self.tab2 = Frame(self.notebook)
        self.notebook.add(self.tab1, text="Data Interaction")
        self.notebook.add(self.tab2, text="Mach-1 Image Grid")
        self.notebook.grid(row=0, column=0, sticky=NW)

        #####  BEGIN TAB 1 #####
        self.frameDataFiles = Frame(self.tab1)
        self.frameDataFiles.grid(row=0, column=0, sticky=N+W+E)
        self.buttonLoadFile = Button(self.frameDataFiles, text="Load Data File",
                                     command=self.loadFile)
        self.buttonLoadFile.grid(row=0, column=0, padx=1, pady=1,
                                 sticky=N+W+E)
        self.buttonRemoveFile = Button(self.frameDataFiles, text="Remove Selected File",
                                       command=self.removeDataObject)
        self.buttonRemoveFile.grid(row=1, column=0, padx=1, pady=1, sticky=N+W+E)
        self.frameDataObjects = LabelFrame(self.tab1, text="Data Files")
        self.frameDataObjects.grid(row=0, column=1, padx=1, pady=1, sticky=N+W+E)

        self.frameGroups = LabelFrame(self.tab1, text="Group Selection")
        self.frameGroups.grid(row=1, column=0, padx=1, pady=1,
                              sticky=N+W+E )
        Label(self.frameGroups, text="").grid(row=0, column=0, sticky=N+W+E)
        self.frameChannels = LabelFrame(self.tab1, text="Channel Selection")
        self.frameChannels.grid(row=1, column=1, padx=1, pady=1,
                                sticky=N+W+E)
        Label(self.frameChannels, text="").grid(row=0, column=0, sticky=N+W+E)

        self.frameTab1BottomLeft = Frame(self.tab1)
        self.frameTab1BottomLeft.grid(row=2, column=0, padx=1, pady=1, sticky=N+W+E)
        self.buttonSaveFile = Button(self.frameTab1BottomLeft, text="Save Selected to Pickle",
                                     command=self.saveFile)
        self.buttonSaveFile.grid(row=0, column=0, padx=1, pady=1,
                                 sticky=N+W+E)

        self.buttonSaveCSV = Button(self.frameTab1BottomLeft, text="Save Selected to CSV",
                                    command=self.saveCSV)
        self.buttonSaveCSV.grid(row=1, column=0, padx=1, pady=1, sticky=N+W+E)

        self.buttonGetThickness = Button(self.frameTab1BottomLeft, text="Get Mach-1 Thicknesses",
                                         command=self.findThicknesses)
        self.buttonGetThickness.grid(row=2, column=0, padx=1, pady=1, sticky=N+W+E)

        self.buttonPlot = Button(self.frameTab1BottomLeft, text="Plot Selected Channels",
                                 command=self.plotChannels)
        self.buttonPlot.grid(row=3, column=0, padx=1, pady=1,
                             sticky=N+W+E)

        self.frameTab1BottomRight = Frame(self.tab1)
        self.frameTab1BottomRight.grid(row=2, column=1, padx=1, pady=1, sticky=N+W+E)
        self.buttonMovingAvg = Button(self.frameTab1BottomRight, text="Apply Moving Average",
                                      command=self.applyMovingAvg)
        self.buttonMovingAvg.grid(row=0, column=0, padx=1, pady=1, columnspan=2,
                                  sticky=N+W+E)
        self.windowSize = IntVar(value=10)
        Label(self.frameTab1BottomRight, text="Window Size").grid(row=1, column=0, padx=1, pady=1,
                                                                  sticky=N+W)
        Entry(self.frameTab1BottomRight, textvariable=self.windowSize, width=4).grid(row=1, column=1, padx=1,
                                                                                     pady=1, sticky=N+W)
        #####  END TAB 1 #####

        ##### BEGIN TAB 2 #####
        self.frameImageButtons = Frame(self.tab2)
        self.frameImageButtons.grid(row=0, column=0, padx=1, pady=1, sticky=N+W+E)
        self.buttonLoadImage = Button(self.frameImageButtons, text="Load Image",
                                      command=self.loadImage)
        self.buttonLoadImage.grid(row=0, column=0, padx=1, pady=1, sticky=N+W+E)

        self.buttonLoadMapFile = Button(self.frameImageButtons, text="Load Mach-1 Site Locations",
                                        command=self.loadMachMap)

        self.buttonLoadMapFile.grid(row=1, column=0, padx=1, pady=1, sticky=N+W+E)
        self.buttonDefineMask = Button(self.frameImageButtons, text="Define Mask",
                                       command=self.cropImage)
        self.buttonDefineMask.grid(row=2, column=0, padx=1, pady=1, sticky=N+W+E)
        self.buttonClearMask = Button(self.frameImageButtons, text="Clear Mask",
                                      command=self.clearMask)
        self.buttonClearMask.grid(row=3, column=0, padx=1, pady=1, sticky=N+W+E)

        self.frameFieldVariables = LabelFrame(self.tab2, text="Field Variables")
        self.frameFieldVariables.grid(row=1, column=0, padx=1, pady=1, sticky=N+W+E)

        ##### END TAB 2 #####
        self.grid()

    def loadFile(self):
        self.filename = tkFileDialog.askopenfilename(
            parent=root,
#.........这里部分代码省略.........
开发者ID:siboles,项目名称:PoroMech,代码行数:103,代码来源:PoroMechGUI.py

示例5: DataExploreGUI

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
class DataExploreGUI(Frame):
    def __init__(self, master):
        Frame.__init__(self, master)
        self.nb = Notebook(self)
        self.tab1 = Frame(self.nb)
        self.tab2 = Frame(self.nb)
        self.tab3 = Frame(self.nb)

        self.nb.add(self.tab1, text='Raw Data')
        self.nb.add(self.tab2, text='Quality metrics')
        self.nb.add(self.tab3, text='Friction tests')
        self.nb.grid(row=0, column=0, sticky=NW)

        self.intSettings = {'Group': IntVar(value=0)}
        self.intSettings2 = {'Group': IntVar(value=0)}
        self.intSettings3 = {'Group': IntVar(value=0)}
        self.intSettings4 = {'Group': IntVar(value=0)}

        # Tab1 buttons
        self.buttonLoadFile = Button(self.tab1, text="Load Data File",
                                     command=self.loadFile)
        self.buttonLoadFile.grid(row=0, column=0, padx=5, pady=5,
                                 sticky=W + E)
        self.buttonSavePlot = Button(self.tab1, text="Save Plot as SVG",
                                     command=self.savePlotFrame1)
        self.buttonSavePlot.grid(row=0, column=1, padx=5, pady=5,
                                 sticky=W + E)

        self.frameGroups = LabelFrame(self.tab1, text="Group Selection")
        self.frameGroups.grid(row=1, column=0, padx=5, pady=5,
                              sticky=N + E + W + S)
        Label(self.frameGroups, text="").pack(anchor=W)
        self.frameChannels = LabelFrame(self.tab1, text="Channel Selection")
        self.frameChannels.grid(row=1, column=1, padx=5, pady=5,
                                sticky=N + E + W + S)
        Label(self.frameChannels, text="").pack(anchor=W)

        self.buttonPlot = Button(self.tab1, text="Plot Selected Channels",
                                 command=self.plotChannels)
        self.buttonPlot.grid(row=2, column=0, padx=5, pady=5,
                             sticky=W + E)
        self.grid()

        self.fg_sz = (12, 6)
        self.fig = plt.Figure(figsize=self.fg_sz)
        self.canvas = FigureCanvasTkAgg(self.fig, master=self.tab1)
        self.canvas.get_tk_widget().grid(column=2, row=1)

        # Tab2 button
        self.frameGroups3 = LabelFrame(self.tab2, text="Stress Relaxation")
        self.frameGroups3.grid(row=1, column=0, padx=5, pady=5,
                               sticky=N + E + W + S)
        Label(self.frameGroups3, text="").pack(anchor=W)

        self.frameGroups4 = LabelFrame(self.tab2, text="X-Y alignment")
        self.frameGroups4.grid(row=1, column=1, padx=5, pady=5,
                               sticky=N + E + W + S)
        Label(self.frameGroups4, text="").pack(anchor=W)

        self.fig2 = plt.Figure(figsize=self.fg_sz)
        self.canvas2 = FigureCanvasTkAgg(self.fig2, master=self.tab2)
        self.canvas2.get_tk_widget().grid(column=2, row=1)

        self.buttonSavePlot2 = Button(self.tab2, text="Save Plot as SVG",
                                      command=self.savePlotFrame2)
        self.buttonSavePlot2.grid(row=0, column=0, padx=5, pady=5,
                                 sticky=W + E)

        # Tab3 button
        self.buttonAnalyze = Button(self.tab3, text="Plot friction line",
                                    command=self.plotMu)
        self.buttonAnalyze.grid(row=0, column=0, padx=5, pady=5,
                                sticky=W + E)

        self.frameGroups2 = LabelFrame(self.tab3, text="Friction Run")
        self.frameGroups2.grid(row=1, column=0, padx=5, pady=5,
                               sticky=N + E + W + S)
        Label(self.frameGroups2, text="").pack(anchor=W)

    def loadFile(self):
        # read file into data object
        self.filename = get_filename()
        file_info, repaired = decompose_file_name(self.filename)

        if repaired:
            self.data = cPickle.load(open(self.filename, "rb"))
        else:
            self.data = parse_file(self.filename)

        self.data_obj = FrictionData(self.data, file_info)

        if self.filename:
            for child in self.frameGroups.pack_slaves():
                child.destroy()
            count = 1
            count2 = 1
            self.blockmap = {}
            self.blockmap2 = {}
            for i, g in enumerate(self.data.keys()):
                tag = self.data[g]['tag'][0]
#.........这里部分代码省略.........
开发者ID:mlsamsom,项目名称:PyFrictionTools,代码行数:103,代码来源:DataExplorer.py

示例6: GoalTrak

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
class GoalTrak(Tk):
    def __init__(self,parent):
        Tk.__init__(self,parent)
        self.parent = parent
        self.initialize()

    def initialize(self):
        self.grid()
        
        self.entryVariable = StringVar() #Student entry box
        self.entry = Entry(self,textvariable=self.entryVariable)
        self.entry.grid(column=0,row=1,sticky='EW')
        self.entry.bind("<Return>", self.onPressEnter)
        self.entryVariable.set(u"Enter new student here")
        
        #Simple buttons#
        
        self.quitButton = Button(self,text=u"Quit", command=self.onQuitClick) #Quit button
        self.quitButton.grid(row = 14, sticky='SE')
        
        self.removeButton = Button(self, text=u"Remove student", command=self.onRemoveClick) #Remove student button
        self.removeButton.grid(column=0,row=6, sticky = 'W')
        
        self.optionMenu = Button(self, text=u"About", command=self.onAboutClick) #About button
        self.optionMenu.grid(row = 13, sticky='SE')
        
        self.infoUpdate = Button(self, text=u"Update Student Info", command=self.onInfoUpdateClick) #Info updater
        self.infoUpdate.grid(column=0, row=4, sticky = 'W')
        
        self.showInformation = Button(self, text = u"Show Information", command=self.onShowInformationClick)
        self.showInformation.grid(column=0, row=5, sticky = 'W')
        
        self.labelVariable = StringVar() #Banner
        self.labelVariable.set(u"Welcome to GoalTrak")
        label = Label(self,textvariable=self.labelVariable, \
        anchor="w",fg="white",bg="navy")
        label.grid(column=0,row=0,sticky='EW')
        
        self.StudentListDisplay = Listbox(self) #Student List
        self.StudentListDisplay.grid(row=2,column=0,columnspan=2,sticky='W')
        for student in student_list:
            self.StudentListDisplay.insert(END, student)
        
        self.tab = Notebook(width=200, height=200) #Notebook
        self.tab.pressed_index = None
        
        ###Notebook###
        
        self.studentInfoDisplayFrame = Frame(self.tab) ####Info display tab###
        
        self.studentNameLabelVar = StringVar() #Student name label
        self.studentNameLabelVar.set('Click "show information"')
        studentNameLabel = Label(self.studentInfoDisplayFrame, textvariable=self.studentNameLabelVar, fg='black', bg='white')
        studentNameLabel.grid(column=0,row=0,sticky='NW')
        
        self.studentClassLabelVar = StringVar() #Student class label
        self.studentClassLabelVar.set('')
        studentClassLabel = Label(self.studentInfoDisplayFrame, textvariable=self.studentClassLabelVar, fg='black', bg='white')
        studentClassLabel.grid(column=0,row=1,sticky='W')
        
        self.studentGoal1LabelVar = StringVar() #Student goal1 label
        self.studentGoal1LabelVar.set('')
        studentGoal1Label = Label(self.studentInfoDisplayFrame, textvariable=self.studentGoal1LabelVar, fg='black', bg='white')
        studentGoal1Label.grid(column=0,row=2,sticky='W')
        
        otherWidget = Canvas(self.tab, width=300, height=300) #Empty widget for fun!
        
        self.tab.add(self.studentInfoDisplayFrame, text='Student Info') #Labels tabs
        self.tab.add(otherWidget, text='Other Widget')
        self.tab.grid(column = 0, row = 7, rowspan = 5, sticky = 'EW')


        self.grid_columnconfigure(0,weight=1) #This makes it so the window is resizable
        self.resizable(True,True)
        self.update()
        self.geometry(self.geometry())
        self.entry.focus_set()
        self.entry.selection_range(0, END)
        
        
    def onAboutClick(self): #About message
        tkMessageBox.showinfo(title=u'About', message=u'GoalTrak v. Alpha V by Eli Dinkelspiel')
    
        
    def student_list_updater(self, studentlist):
        self.StudentListDisplay.delete(0, END)
        for student in studentlist:
            self.StudentListDisplay.insert(END, student)#Refreshes student listbox
    
    def onQuitClick(self):
        result = tkMessageBox.askokcancel(title='GoalTrak', message='Are you sure you want to quit GoalTrak?')
        if result == True:
            GoalTrak.destroy(self) #Quit button
               
    def onRemoveClick(self):
        index = self.StudentListDisplay.curselection()
        index = int(index[0])
        result = tkMessageBox.askokcancel(title='Are you sure?', \
        message='Are you sure you want to remove %s? This cannot be undone and will remove all associated data.' \
        % (student_list[index]))
#.........这里部分代码省略.........
开发者ID:elidinkelspiel,项目名称:GoalTrak,代码行数:103,代码来源:v.0.0.5.py

示例7: GUI

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
class GUI(tk.Tk):
    """
    Start graphical interface for client.

    Args:
        client_queue_cmd: queue to send commands
        client_queue_log: queue to get logging info
        client_queue_telem: queue to get telemetry data
        beam_gap_queue: queue to retrieve beam gap data (any queue will do, this is handled via the gui, through the telemetry queue)
        @depricated
        server_ip: server IP address for rtp stream access
    """
    def __init__(self, client_queue_cmd, client_queue_log, client_queue_telem, beam_gap_queue, destroyEvent, server_ip, **kwargs):
        tk.Tk.__init__(self, **kwargs)
        self.client_queue_cmd = client_queue_cmd
        self.client_queue_log = client_queue_log
        self.client_queue_telem = client_queue_telem
        self.beam_gap_queue = beam_gap_queue
        self.server_ip = server_ip
        self.destroyEvent = destroyEvent

    def init_ui(self):
        #make resizable
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)

        self.notebook = Notebook(self)
        # define mainapp instance -- also manages above telemetry thread
        self.mainApplication = MainApplication(self, self.client_queue_cmd, self.client_queue_log, self.client_queue_telem, self.beam_gap_queue, self.destroyEvent, self.server_ip) 
        self.notebook.add(self.mainApplication, text = "Main")
        # define telemetry widgets
        self.monitor = Monitor(self, VisualConstants.MARS_PRIMARY(1))
        self.notebook.add(self.monitor, text = 'Monitor')
        self.notebook.grid(column = 0, row = 0, sticky = 'nsew')
        
        # menu -outside of notebook
        self.menu_ = TopMenu(self, '../gui/operations.json', self.client_queue_cmd, 'Commands')
        ### Add custom commands here
        self.menu_.add_menu_item('Reconnect to Cameras', self.mainApplication.start_streams, "View")
        self.menu_.add_menu_item('Left', self.mainApplication.focus_left, 'View/Camera Focus')
        self.menu_.add_menu_item('Center', self.mainApplication.focus_center, 'View/Camera Focus')
        self.menu_.add_menu_item('Right', self.mainApplication.focus_right, 'View/Camera Focus')
        self.menu_.add_menu_item('IBeam Display', self.beamGapGraph, 'View/Windows')
        self.menu_.add_menu_item('Toggle FOD Enabled', self.mainApplication.toggle_fod, 'View/Object Detection')
        self.menu_.add_menu_item('Set Ideal Images', self.mainApplication.define_ideal_images, 'View/Object Detection')
        ### 
        self.menu_.finalize_menu_items()
        self.config(menu=self.menu_)
        
        # start all operations here so we don't cause a hissyfit between tkinter and threads
        self.mainApplication.start_streams()
        #define telemetryThread
        self.tthread = TelemetryThread([self.mainApplication.telemetry_w, self.monitor], self.client_queue_telem, self.beam_gap_queue)
        self.tthread.start()

        # title and icon
        self.wm_title('Hyperloop Imaging Team')
        #this is garbage, i hate tkinter
        #self.img = ImageTk.PhotoImage(file='rit_imaging_team.xbm')
        #self.tk.call('wm', 'iconphoto', self._w, self.img)
        #self.iconbitmap('@rit_imaging_team.xbm')
        #call destroyCallback on clicking X
        self.protocol('WM_DELETE_WINDOW', self.destroyCallback)
        

        #assign dimensions and locatin on screen
        width = 900
        height = 500
 
        x = (self.winfo_screenwidth() // 2) - (width // 2)
        y = (self.winfo_screenheight() // 2) - (height // 2)
        self.geometry('{}x{}+{}+{}'.format(width, height, x, y))
        
        self.update()

    def killMars(self):
        '''
        Sends the kill command to Mars
        '''
        logger.debug('GUI Killing Mars...')
        self.client_queue_cmd.put('exit')

    def displayMarsDisconnected(self):
        tkMessageBox.showerror('Lost connection to Mars', 'The client has lossed connection to mars, closing application.')
        self.destroyClient()

    def destroyClient(self):
        logger.debug('GUI Killing Main App...')
        self.menu_.destroy() 
        self.mainApplication.close_()
        logger.debug('GUI Killing Monitor app...')
        self.monitor.destroy()
        self.notebook.destroy()
        logger.debug('GUI Killing Self...')
        self.killTelemThread()
        logger.debug('GUI Dead')
        self.quit()
        self.destroy()
 
    def killTelemThread(self):
#.........这里部分代码省略.........
开发者ID:JoeBartelmo,项目名称:PyDetect,代码行数:103,代码来源:gui.py

示例8: __init__

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
class channel_plot:
    '''
    '''

    def __init__(self, interface, toplevel=False, start_t=False, stop_t=False):
        '''
        '''
        self.abort = False
        if not start_t:
            start_t = datetime.utcnow() - timedelta(hours=2)
        if not stop_t:
            stop_t = datetime.utcnow()
        self.update_pending = False
        self.pype = interface
        self.plot_dicts = {}
        if isinstance(start_t, datetime):
            self.start_t = StringVar(value=start_t.strftime(time_format))
        elif isinstance(start_t, str):
            self.start_t = StringVar(value=start_t)
        else:
            raise TypeError('start_t must be string or datetime')
        if isinstance(stop_t, datetime):
            self.stop_t = StringVar(value=stop_t.strftime(time_format))
        elif isinstance(stop_t, str):
            self.stop_t = StringVar(value=stop_t)
        else:
            raise TypeError('stop_t must be string or datetime')
        self.time_interval = [self.start_t.get(), self.stop_t.get()]
        self.ymin = DoubleVar()
        self.ymax = DoubleVar()
        if toplevel:
            self.toplevel = toplevel
        else:
            self.toplevel = Tk.Tk()
        self.status_var = StringVar(value='initializing')
        self._SetupCanvas()
        self._BuildGui()
        if not toplevel:
            Tk.mainloop()

    def _BuildGui(self):
        '''
        '''
        self.removei = IntVar(value=0)
        self.relative_start_time = BooleanVar(value=False)
        self.relative_stop_time = BooleanVar(value=False)
        self.continuous_updates = BooleanVar(value=False)
        self.ManualLimits = BooleanVar(value=False)
        self.LogYScale = BooleanVar(value=False)
        self.ShowGrid = BooleanVar(value=False)
        self.ConnectedPts = BooleanVar(value=True)
        Button(self.toplevel, text="Add Line", command=self._AddSubplot
               ).grid(row=0, column=1)
        self._AddSubplot()
        Button(self.toplevel, text="Gas Line Temps", command=self._PlotGasLines
               ).grid(row=0, column=2)
        Button(self.toplevel, text="Amps+Cell Temps", command=self._PlotCell
               ).grid(row=0, column=3)

        Label(self.toplevel, text='Start Time').grid(row=4, column=1)
        start_entry = Entry(self.toplevel, textvariable=self.start_t)
        start_entry.bind('<Return>', self.Update)
        start_entry.bind('<KP_Enter>', self.Update, '+')
        start_entry.grid(row=4, column=2, columnspan=2)
        Checkbutton(self.toplevel, text='Hours ago',
                    variable=self.relative_start_time).grid(row=4, column=4,
                                                            sticky='W')

        Label(self.toplevel, text='Stop Time').grid(row=5, column=1)
        stop_entry = Entry(self.toplevel, textvariable=self.stop_t)
        stop_entry.bind('<Return>', self.Update)
        stop_entry.bind('<KP_Enter>', self.Update, '+')
        stop_entry.grid(row=5, column=2, columnspan=2)
        Checkbutton(self.toplevel, text='Now',
                    variable=self.relative_stop_time).grid(row=5, column=4,
                                                           sticky='W')

        Label(self.toplevel, text='Y limits (min-max)').grid(row=7, column=1)
        ymin = Entry(self.toplevel, textvariable=self.ymin)
        ymin.grid(row=7, column=2)
        ymin.bind('<Return>', self.Update)
        ymin.bind('<KP_Enter>', self.Update, '+')
        ymax = Entry(self.toplevel, textvariable=self.ymax)
        ymax.grid(row=7, column=3)
        ymax.bind('<Return>', self.Update)
        ymax.bind('<KP_Enter>', self.Update, '+')
        Checkbutton(self.toplevel, text='Manual Y-limits', variable=self.ManualLimits
                    ).grid(row=8, column=1)
        Checkbutton(self.toplevel, text='Log Y-scale', variable=self.LogYScale
                    ).grid(row=8, column=2)
        Checkbutton(self.toplevel, text='Show Grid', variable=self.ShowGrid
                    ).grid(row=9, column=1)
        Checkbutton(self.toplevel, text='Connected Points', variable=self.ConnectedPts
                    ).grid(row=9, column=2)

        Button(self.toplevel, text="Update All", command=self.Update
               ).grid(row=10, column=1)
        Button(self.toplevel, text="Save Plot", command=self.SaveFigure
               ).grid(row=10, column=2)
        Button(self.toplevel, text="Save Json", command=self.SaveJson
#.........这里部分代码省略.........
开发者ID:project8,项目名称:Pypeline,代码行数:103,代码来源:channel_plot.py

示例9: GoalTrak

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
class GoalTrak(Tk):
    def __init__(self,parent):
        Tk.__init__(self,parent)
        self.parent = parent
        self.initialize()

    def initialize(self):
        self.grid()
        
        self.entryVariable = StringVar() #Student entry box
        self.entry = Entry(self,textvariable=self.entryVariable)
        self.entry.grid(column=0,row=1,sticky='EW')
        self.entry.bind("<Return>", self.onPressEnter)
        self.entryVariable.set(u"Enter new student here")
        
        #Simple buttons#
        
        self.quitButton = Button(self,text=u"Quit", command=self.onQuitClick) #Quit button
        self.quitButton.grid(row = 14, sticky='SE')
        
        self.removeButton = Button(self, text=u"Remove student", command=self.onRemoveClick) #Remove student button
        self.removeButton.grid(column=0,row=6, sticky = 'W')
        
        self.optionMenu = Button(self, text=u"About", command=self.onAboutClick) #About button
        self.optionMenu.grid(row = 13, sticky='SE')
        
        self.infoUpdate = Button(self, text=u"Update Student Info", command=self.onInfoUpdateClick) #Info updater
        self.infoUpdate.grid(column=0, row=4, sticky = 'W')
        
        self.showInformation = Button(self, text = u"Show Information", command=self.onShowInformationClick)
        self.showInformation.grid(column=0, row=5, sticky = 'W')
        
        self.labelVariable = StringVar() #Banner
        self.labelVariable.set(u"Welcome to GoalTrak")
        label = Label(self,textvariable=self.labelVariable, \
        anchor="w",fg="white",bg="navy")
        label.grid(column=0,row=0,sticky='EW')
        
        self.StudentListDisplay = Listbox(self) #Student List
        self.StudentListDisplay.grid(row=2,column=0,columnspan=2,sticky='W')
        for student in student_list:
            self.StudentListDisplay.insert(END, student)
        
        self.tab = Notebook(width = 500, height = 300) #Notebook
        self.tab.pressed_index = None
        
        
        ###Notebook###
        
        self.studentInfoDisplayFrame = Frame(self.tab) ####Info display tab###
        
        self.studentNameLabelVar = StringVar() #Student name label
        self.studentNameLabelVar.set('Click "show information"')
        studentNameLabel = Label(self.studentInfoDisplayFrame, textvariable=self.studentNameLabelVar, fg='black', bg='white')
        studentNameLabel.grid(column=0,row=0,sticky='NW')
        
        self.studentClassLabelVar = StringVar() #Student class label
        self.studentClassLabelVar.set('')
        studentClassLabel = Label(self.studentInfoDisplayFrame, textvariable=self.studentClassLabelVar, fg='black', bg='white')
        studentClassLabel.grid(column=0,row=1,sticky='W')
        
        self.studentGoal1LabelVar = StringVar() #Student goal1 label
        self.studentGoal1LabelVar.set('')
        studentGoal1Label = Label(self.studentInfoDisplayFrame, textvariable=self.studentGoal1LabelVar, fg='black', bg='white')
        studentGoal1Label.grid(column=0,row=2,sticky='W')
        
        self.dataGenerationFrame = Frame(self.tab) ###Data entry frame###
        self.dataGenerationFrame.grid()
        
        self.listboxFrame = Frame(self.dataGenerationFrame) #LISTBOX
        self.listboxFrame.grid(column=0, row=0, columnspan=2, rowspan=2, padx=2, pady=2)
        self.goalSelection = Listbox(self.listboxFrame)
        self.goalSelection.pack()
        
        self.goalValEntryFrame = Frame(self.dataGenerationFrame) #SPINBOX
        self.goalValEntryFrame.grid(row= 0, column=4, padx=2, pady=2)
        self.goalValEntry = Spinbox(self.goalValEntryFrame, from_=0, to=10)
        self.goalValEntry.pack()
        
        self.noteEntryFrame = Frame(self.dataGenerationFrame) #TEXT
        self.noteEntryFrame.grid(column= 2, row=1, columnspan=3, rowspan=3, padx=2, pady=2)
        self.noteEntry = Text(self.noteEntryFrame, borderwidth=2, height = 15, width = 40, relief=SUNKEN)
        self.noteEntry.pack(anchor= 'w')
        
        self.buttonBox = Frame(self.dataGenerationFrame)
        self.buttonBox.grid(row= 4, column= 0, columnspan= 2, rowspan= 2, sticky= 'W')
        self.addDataButton = Button(self.buttonBox, text = 'Store Information', command=self.onStoreInformationClick)
        self.addDataButton.pack()
        
        self.tab.add(self.studentInfoDisplayFrame, text='Student Info') #Labels tabs
        self.tab.add(self.dataGenerationFrame, text='Enter Data')
        self.tab.grid(column = 0, row = 7, rowspan = 5, sticky = 'EW')

        self.grid_columnconfigure(0,weight=1) #This makes it so the window is resizable
        self.resizable(True,True)
        self.update()
        self.geometry(self.geometry())
        self.entry.focus_set()
        self.entry.selection_range(0, END)
        
#.........这里部分代码省略.........
开发者ID:elidinkelspiel,项目名称:GoalTrak,代码行数:103,代码来源:v.0.0.6.py

示例10: DicoGIS

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]
class DicoGIS(Tk):
    def __init__(self):
        u"""
        Main window constructor
        Creates 1 frame and 2 labelled subframes
        """

        # basics settings
        Tk.__init__(self)               # constructor of parent graphic class
        self.title(u'DicoGIS {0}'.format(DGversion))

        self.li_raster_formats = ['ecw', 'geotiff']

        # notebook
        self.nb = Notebook(self)
        self.FrProg = Labelframe(self,
                                 name='progression',
                                 text='gui_prog')
        self.FrOutp = Labelframe(self,
                                 name='output',
                                 text='gui_fr4')
        # tabs
        self.tab_files = Frame(self.nb)    # tab_id = 0
        self.tab_sgbd = Frame(self.nb)          # tab_id = 1
        self.tab_webservices = Frame(self.nb)   # tab_id = 2
        self.tab_isogeo = Frame(self.nb)        # tab_id = 3
        self.tab_about = Frame(self.nb)        # tab_id = 4


        ## TAB 1: FILES
        self.nb.add(self.tab_files,
                    text='gui_files', padding=3)
        # frame: path folder
        self.FrPath = Labelframe(self.tab_files,
                                 name='files',
                                 text='gui_fr1')
        self.labtarg = Label(self.FrPath, text='gui_path')
        self.target = Entry(master=self.FrPath, width=35)
        self.browsetarg = Button(self.FrPath,       # browse button
                                 text='gui_choix',
                                 command=lambda: self.setpathtarg(),
                                 takefocus=True)
        self.browsetarg.focus_force()               # force the focus on

        # widgets placement
        self.labtarg.grid(row=1, column=1, columnspan=1,
                          sticky="NSWE", padx=2, pady=2)
        self.target.grid(row=1, column=2, columnspan=1,
                         sticky="NSWE", padx=2, pady=2)
        self.browsetarg.grid(row=1, column=3,
                             sticky="NSWE", padx=2, pady=2)

        # frame: filters
        self.FrFilters = Labelframe(self.tab_files,
                                    name='filters',
                                    text='filters')
        # formats options
        self.opt_shp = IntVar(self.FrFilters)   # able/disable shapefiles
        self.opt_tab = IntVar(self.FrFilters)   # able/disable MapInfo tables
        self.opt_kml = IntVar(self.FrFilters)   # able/disable KML
        self.opt_gml = IntVar(self.FrFilters)   # able/disable GML
        self.opt_geoj = IntVar(self.FrFilters)  # able/disable GeoJSON
        self.opt_gxt = IntVar(self.FrFilters)  # able/disable GXT
        self.opt_egdb = IntVar(self.FrFilters)  # able/disable Esri FileGDB
        self.opt_spadb = IntVar(self.FrFilters)  # able/disable Spatalite DB
        self.opt_rast = IntVar(self.FrFilters)  # able/disable rasters
        self.opt_cdao = IntVar(self.FrFilters)  # able/disable CAO/DAO files
        self.opt_pdf = IntVar(self.FrFilters)   # able/disable Geospatial PDF
        self.opt_lyr = IntVar(self.FrFilters)   # able/disable Geospatial Lyr
        self.opt_mxd = IntVar(self.FrFilters)   # able/disable Geospatial MXD
        self.opt_qgs = IntVar(self.FrFilters)   # able/disable Geospatial QGS

        # format choosen: check buttons
        caz_shp = Checkbutton(self.FrFilters,
                              text=u'.shp',
                              variable=self.opt_shp)
        caz_tab = Checkbutton(self.FrFilters,
                              text=u'.tab',
                              variable=self.opt_tab)
        caz_kml = Checkbutton(self.FrFilters,
                              text=u'.kml',
                              variable=self.opt_kml)
        caz_gml = Checkbutton(self.FrFilters,
                              text=u'.gml',
                              variable=self.opt_gml)
        caz_geoj = Checkbutton(self.FrFilters,
                               text=u'.geojson',
                               variable=self.opt_geoj)
        caz_gxt = Checkbutton(self.FrFilters,
                              text=u'.gxt',
                              variable=self.opt_gxt)
        caz_egdb = Checkbutton(self.FrFilters,
                               text=u'Esri FileGDB',
                               variable=self.opt_egdb)
        caz_spadb = Checkbutton(self.FrFilters,
                                text=u'Spatialite',
                                variable=self.opt_spadb)
        caz_rast = Checkbutton(self.FrFilters,
                               text=u'rasters ({0})'.format(', '.join(self.li_raster_formats)),
                               variable=self.opt_rast)
#.........这里部分代码省略.........
开发者ID:Guts,项目名称:DicoGIS,代码行数:103,代码来源:new_UI.py

示例11: Metadator

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import grid [as 别名]

#.........这里部分代码省略.........
        self.tab_options = Frame(self.nb)   # tab_id = 1
        self.tab_attribs = Frame(self.nb)   # tab_id = 2
        self.nb.add(self.tab_globals,
                    text=self.blabla.get('gui_tab1'), padding=3)
        self.nb.add(self.tab_options,
                    text=self.blabla.get('gui_tab2'), padding=3)
        self.nb.add(self.tab_attribs,
                    text=self.blabla.get('gui_tab3'), padding=3)
        self.logger.info('UI created')

                ### Tab 1: global
        # Frames
        self.FrPath = Labelframe(self.tab_globals,
                                 name='main',
                                 text=self.blabla.get('tab1_fr1'))
        self.FrProg = Labelframe(self.tab_globals,
                                 name='progression',
                                 text=self.blabla.get('tab1_frprog'))
            ## Frame 1
        # target folder
        self.labtarg = Label(self.FrPath, text=self.blabla.get('tab1_path'))
        self.target = Entry(self.FrPath, width=25)
        self.browsetarg = Button(self.FrPath,       # browse button
                                 text=self.blabla.get('tab1_browse'),
                                 command=lambda: self.setpathtarg(),
                                 takefocus=True)
        self.browsetarg.focus_force()               # force the focus on
        self.profil = Label(self.FrPath, text=self.blabla.get('tab1_prof'))
        # profiles switcher
        self.ddl_profil = Combobox(self.FrPath, values=self.li_pro, width=5)
        self.ddl_profil.current(0)
        self.ddl_profil.bind("<<ComboboxSelected>>", self.select_profil)
        # widgets placement
        self.labtarg.grid(row=1, column=1, columnspan=1,
                          sticky=N + S + W + E, padx=2, pady=8)
        self.target.grid(row=1, column=2, columnspan=1,
                         sticky=N + S + W + E, padx=2, pady=8)
        self.browsetarg.grid(row=1, column=3,
                             sticky=N + S + W + E, padx=2, pady=8)
        self.profil.grid(row=2, column=1,
                         sticky=N + S + W + E, padx=2, pady=8)
        self.ddl_profil.grid(row=2, column=2, sticky=W + E + N + S,
                             columnspan=2, padx=2, pady=8)

        # tooltips
        InfoBulle(self.target, message=self.dico_help.get(30)[1])
        InfoBulle(self.browsetarg, message=self.dico_help.get(30)[1])
        InfoBulle(self.ddl_profil, message=self.dico_help.get(31)[1])

            ## Frame 2
        # variables
        self.status = StringVar(self.FrProg, '')
        # widgets
        self.prog_layers = Progressbar(self.FrProg, orient="horizontal")
        self.prog_fields = Progressbar(self.FrProg, orient="horizontal")
        # widgets placement
        Label(self.FrProg, textvariable=self.status,
                           foreground='DodgerBlue').pack(expand=1)
        self.prog_layers.pack(expand=1, fill=X)

        # Frames placement
        self.FrPath.pack(expand=1, fill='both')
        self.FrProg.pack(expand=1, fill='both')

                ### Tab 2: options
        # Export options
开发者ID:Guts,项目名称:Metadator,代码行数:70,代码来源:Metadator.py


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