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


Python Notebook.tabs方法代码示例

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


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

示例1: __init__

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

#.........这里部分代码省略.........
        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
               ).grid(row=10, column=3)
        Checkbutton(self.toplevel, text='Continuous (Button above to start)',
                    variable=self.continuous_updates
                    ).grid(row=11, column=1, columnspan=2)
        self.status_var.set('done')

        Label(self.toplevel, textvariable=self.status_var).grid(row=20,
                                                                column=1,
                                                                columnspan=2)

    def _SetupCanvas(self):
        '''
        '''
        self.figure = Figure()
        self.figure.subplots_adjust(left=0.15, bottom=0.2)
        self.subfigure = self.figure.add_subplot(1,1,1)
        self.notebook = Notebook(self.toplevel)
        self.notebook.grid(row=1, column=1, rowspan=3, columnspan=3, sticky='nsew')
        self.canvas = FigureCanvasTkAgg(self.figure, master=self.toplevel)
        self.canvas.show()
        self.canvas.get_tk_widget().grid(row=0, column=0, rowspan=10)

    def _AddSubplot(self):
        '''
        '''
        plotnum = len(self.notebook.tabs())
        self.plot_dicts[plotnum] = {}
        frame = Frame(self.notebook)
        frame.pack(side='top', fill='both', expand='y')
        self.plot_dicts[plotnum]['xname'] = StringVar(value='None')
        self.plot_dicts['xunit'] = False
        self.plot_dicts[plotnum]['yname'] = StringVar(value='None')
        self.plot_dicts['yunit'] = False
        Label(frame, text='X Channel').grid(row=0, column=0)
        Label(frame, text='Y Channel').grid(row=1, column=0)
        OptionMenu(frame, self.plot_dicts[plotnum]['xname'],
                   "None", "time", "dpph_field", *self.pype.EligibleLoggers()
                   ).grid(row=0, column=1, sticky='ew')
        OptionMenu(frame, self.plot_dicts[plotnum]['yname'],
                   "None", "dpph_field", *self.pype.EligibleLoggers()
                   ).grid(row=1, column=1, sticky='ew')
        self.notebook.add(frame, text='line:'+str(plotnum))

    def _SetStartStop(self, event=None):
        '''
        '''
        try:
            if self.relative_stop_time.get():
                stop_time = datetime.utcnow()
            else:
                stop_time = datetime.strptime(self.stop_t.get(), time_format)
            if self.relative_start_time.get():
                hours = float(self.start_t.get())
                start = datetime.utcnow() - timedelta(hours=hours)
            else:
                start = datetime.strptime(self.start_t.get(), time_format)
            assert (start < stop_time)
            self.time_interval[0] = start.strftime(time_format)
开发者ID:project8,项目名称:Pypeline,代码行数:70,代码来源:channel_plot.py

示例2: View

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import tabs [as 别名]
class View(Toplevel):
    def __init__(self, model):
        self.model = model
        self.model_config = self.model.get_config()
        self.channels_num = 0
        self.channels_amount = 0

        self.root = Tk()
        self.root.resizable(width=FALSE, height=FALSE)
        self.root.title("RaaS. event_proxy configurator")
        #: self.root.iconbitmap('resourse/vit.ico')
        self.config_route = self.model.get_config_route()

        self.panelFrame = Frame(self.root, height=60)
        self.canvas = Canvas(self.root, borderwidth=0)
        self.textFrame = Frame(self.canvas, height=340, width=600)
        self.mainFrame = LabelFrame(self.root, width=200, text="Main:",
                                    height=340, relief=RAISED, borderwidth=1)
        self.chanelFrame = LabelFrame(self.root, width=370, text="Channels:",
                                      height=340, relief=RAISED, borderwidth=1)

        #: self.vsb = Scrollbar(self.root, orient="horizontal",
        #:                     command=self.canvas.xview)
        #:self.canvas.configure(xscrollcommand=self.vsb.set)
        #:self.vsb.pack(side="bottom", fill="x")
        self.canvas.pack(side="bottom", fill="both", expand=True)
        self.canvas.configure(scrollregion=self.canvas.bbox("all"))
        self.root.protocol("WM_DELETE_WINDOW", self.quit_handler)

        self.tabs = Notebook(self.root)
        self.in_channel_text = []
        self.out_port_text = []
        self.out_channel_text = []

        self.c = self.model.get_channels().keys()
        self.channels_len = len(self.model.get_channels())
        #:print self.model.get_channels()
        self.panelFrame.pack(side='top', fill='x')
        self.textFrame.pack(side='bottom', fill='both', expand=1)
        self.mainFrame.place(x=10, y=60)
        self.chanelFrame.place(x=220, y=60)
        self.tabs.place(x=230, y=80)

        x = (self.root.winfo_screenwidth() - self.root.winfo_reqwidth()) / 2
        y = (self.root.winfo_screenheight() - self.root.winfo_reqheight()) / 2
        self.root.geometry("+%d+%d" % (x-150, y-150))

        for i in range(self.channels_len):
            self.channels_num += 1
            self.channels_amount += 1

            self.f1 = Frame(self.tabs, height=290, width=350)
            self.tabs.add(self.f1, text='Channel {0}'.format(i + 1))

            self.in_channel = Label(self.f1, text="In channel")
            self.out_port = Label(self.f1, text="Out port")
            self.out_channel = Label(self.f1, text="Out channel")

            self.in_channel_text.append(Entry(self.f1, width=20, bd=3))
            self.in_channel_text[i].insert(0, self.c[i])

            self.out_port_text.append(Entry(self.f1, width=20, bd=3))
            self.out_port_text[i].insert(0, self.model.get_channels()[
                self.c[i]].out_port)

            self.out_channel_text.append(Entry(self.f1, width=20, bd=3))
            self.out_channel_text[i].insert(0, self.model.get_channels()[
                self.c[i]].out_channel)

            self.in_channel.place(x=5, y=10)
            self.in_channel_text[i].place(x=5, y=30)

            self.out_port.place(x=5, y=50)
            self.out_port_text[i].place(x=5, y=70)

            self.out_channel.place(x=5, y=90)
            self.out_channel_text[i].place(x=5, y=110)

            self.del_ch_btn = Button(self.f1, text='Delete channel {0}'.format(
                self.channels_amount),
                                     command=
                                     lambda: self.del_channel(i))
            self.del_ch_btn.bind("<Button-1>")
            self.del_ch_btn.place(x=5, y=140, width=100, height=30)

        self.server_host_label = Label(self.root, text="Server host")
        self.server_port_label = Label(self.root, text="Server port")
        self.raas_port_label = Label(self.root, text="Raas port")
        self.encoding_label = Label(self.root, text='Encoding')
        self.levenshtein_distance_label = Label(self.root,
                                                text='Levenshtein distance')
        self.window_time_label = Label(self.root, text='Window time')

        self.server_host_entity = Entry(self.root, width=20, bd=3)
        self.server_host_entity.insert(0, self.model_config['server_host'])

        self.server_port_entity = Entry(self.root, width=20, bd=3)
        self.server_port_entity.insert(0, self.model_config['server_port'])

        self.raas_port_entity = Entry(self.root, width=20, bd=3)
#.........这里部分代码省略.........
开发者ID:imressed,项目名称:pythonway,代码行数:103,代码来源:tkinter.py

示例3: __init__

# 需要导入模块: from ttk import Notebook [as 别名]
# 或者: from ttk.Notebook import tabs [as 别名]
    def __init__(self):

        self.tasks = None
        self.mainTerminated = None
        self.results = None
        self.awaited = None

        self.reqParser = RawQueryParser()

        self.defaultCfg = defaultCfg
        self.stlist = STAT_TYPES.keys()

        # set main window parameters
        mainWindow = SmartTk()
        mainWindow.title(_WindowLabels.window_title)
        self.root = mainWindow
        mainWindow.minsize(650, 450)

        # there are two frames with different finctions.
        # In fact, they work separately but use the same set of settings.
        generalframe = SettingHybrid(mainWindow)
        tabframe = Frame(mainWindow)

        self.settings = generalframe

        nb = Notebook(tabframe)
        nbUrlTab = Frame()
        nbFileEditingTab = Frame()
        nbStatTab = StatTypeFrame()
        self.statTab = nbStatTab
        self.homeDir = None


        qField = ParameterInputText(nbFileEditingTab)
        self.qField = qField
        qReadingButton = Button(nbFileEditingTab, text = u'OK', command = self.get_request_from_raw_query_window)

        self.urlText = CopyPasteText(nbUrlTab)
        urlButton = Button(nbUrlTab, text = u'OK', command = self.get_query_from_url_window)

        self.urlText.pack(fill=BOTH, expand=1)
        urlButton.pack()

        self.b1 = urlButton
        self.b2 = qReadingButton

        nb.add(nbFileEditingTab, text = tabs['file'])
        nb.add(nbUrlTab, text = tabs['url'])
        nb.add(nbStatTab, text = tabs['st'])

        minTabFrameWidth = 0
        for tab in nb.tabs():
            minTabFrameWidth += len(nb.tab(tab)['text'])

        self.root.config(width = minTabFrameWidth + 200)

        qField.pack(fill=BOTH, expand=1)
        qReadingButton.pack()
        #nbUrlTab.pack()
        nb.pack(fill=BOTH, expand=1)

        self.nb = nb # to manage tabs

        generalframe.pack(expand=0, side = 'left')
        tabframe.pack(fill=BOTH, expand=1)

        generalframe.bind_to_statistics_frame(nbStatTab)

        self.enable_keyboard_managing()
        self._add_menu()
开发者ID:sleepofnodreaming,项目名称:ruscorporaXML,代码行数:72,代码来源:tabgui.py


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