python类Frame()的实例源码

GUI_DesignPattern.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def createWidgets(self):    
        tabControl = ttk.Notebook(self.win)     
        tab1 = ttk.Frame(tabControl)            
        tabControl.add(tab1, text='Tab 1')    
        tabControl.pack(expand=1, fill="both")  
        self.monty = ttk.LabelFrame(tab1, text=' Monty Python ')
        self.monty.grid(column=0, row=0, padx=8, pady=4)        

        scr = scrolledtext.ScrolledText(self.monty, width=30, height=3, wrap=tk.WORD)
        scr.grid(column=0, row=3, sticky='WE', columnspan=3)

        menuBar = Menu(tab1)
        self.win.config(menu=menuBar)
        fileMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="File", menu=fileMenu)
        helpMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="Help", menu=helpMenu)

        self.createButtons()
filenavigator.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, parent, directory, *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._directory = directory

        self.images = {"Directory": tk.PhotoImage(),
                       "File": tk.PhotoImage()}

        self.selected = None

        self._tree = ttk.Treeview(self, show="tree")
        self._tree.pack(fill="both", expand=True)

        self._tree.bind("<<TreeviewSelect>>", self._select, "+")
        # self._tree.bind("<Double-Button-1>", self._open_event)
        self._tree.bind("<<TreeviewOpen>>", self._open_event, "+")
        self._tree.bind("<<TreeviewClose>>", self._close_event, "+")

        self.refresh()
collapsiblepane.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, parent, expanded_text="Collapse <<", collapsed_text="Expand >>", *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._expanded_text = expanded_text
        self._collapsed_text = collapsed_text

        self.columnconfigure(1, weight=1)

        self._variable = tk.IntVar()
        self._button = ttk.Checkbutton(self, variable=self._variable, command=self._activate, style="TButton")
        self._button.grid(row=0, column=0)

        self._separator = ttk.Separator(self, orient="horizontal")
        self._separator.grid(row=0, column=1, sticky="we")

        self.frame = ttk.Frame(self)

        self._activate()
labeledseparator.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent, text="", orient="horizontal", text_align="", padding=5, *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._text = text
        self._orient = orient
        self._text_align = text_align
        self._padding = padding

        self._separator = ttk.Separator(self, orient=self._orient)
        self._label = ttk.Label(self, text=self._text)

        if self._orient == "horizontal":
            self.grid_columnconfigure(0, weight=1)

            self._separator.grid(row=0, column=0, sticky="we")
            self._label.grid(row=0, column=0, sticky=self._text_align, padx=self._padding)

        elif self._orient == "vertical":
            self.grid_rowconfigure(0, weight=1)

            self._separator.grid(row=0, column=0, sticky="ns")
            self._label.grid(row=0, column=0, sticky=self._text_align, pady=self._padding)

##################################################
eval_gui.py 文件源码 项目:python-tagger 作者: Bilingual-Annotation-Task-Force 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _create_widgets(self):
        # Gold standard data
        self.gold_path_label = ttk.Label(text="Gold Standard:")
        self.gold_path_entry = ttk.Entry(textvariable=self.gold_path)
        self.gold_path_filebutton = ttk.Button(text="...", command=self.findgoldfile)
        # Training data for language 1
        self.lang1_train_path_label = ttk.Label(text="Language 1 Training Data:")
        self.lang1_train_path_entry = ttk.Entry(textvariable=self.lang1_train_path)
        self.lang1_train_path_filebutton = ttk.Button(text="...", command=self.findlang1trainfile)
        # Training data for language 2
        self.lang2_train_path_label = ttk.Label(text="Language 2 Training Data:")
        self.lang2_train_path_entry = ttk.Entry(textvariable=self.lang2_train_path)
        self.lang2_train_path_filebutton = ttk.Button(text="...", command=self.findlang2trainfile)
        # Examination
        self.examine_button = ttk.Button(text="Examine!", command=self.launch_main)
        # Redirected ouput
        self.output_frame = ttk.Frame()
        self.output = tk.Text(master=self.output_frame)
        self.output_scroll = ttk.Scrollbar(self.output_frame)
        self.output.configure(yscrollcommand=self.output_scroll.set)
        self.output_scroll.configure(command=self.output.yview)

        self.redirected = Redirector(self.output)
box.py 文件源码 项目:synthesizer 作者: irmen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, app, master):
        super().__init__(master, text="Playlist", padding=4)
        self.app = app
        bf = ttk.Frame(self)
        ttk.Button(bf, text="Move to Top", width=11, command=self.do_to_top).pack()
        ttk.Button(bf, text="Move Up", width=11, command=self.do_move_up).pack()
        ttk.Button(bf, text="Move Down", width=11, command=self.do_move_down).pack()
        ttk.Button(bf, text="Remove", width=11, command=self.do_remove).pack()
        bf.pack(side=tk.LEFT, padx=4)
        sf = ttk.Frame(self)
        cols = [("title", 300), ("artist", 180), ("album", 180), ("length", 60)]
        self.listTree = ttk.Treeview(sf, columns=[col for col, _ in cols], height=10, show="headings")
        vsb = ttk.Scrollbar(orient="vertical", command=self.listTree.yview)
        self.listTree.configure(yscrollcommand=vsb.set)
        self.listTree.grid(column=1, row=0, sticky=tk.NSEW, in_=sf)
        vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf)
        for col, colwidth in cols:
            self.listTree.heading(col, text=col.title())
            self.listTree.column(col, width=colwidth)
        sf.grid_columnconfigure(0, weight=1)
        sf.grid_rowconfigure(0, weight=1)
        sf.pack(side=tk.LEFT, padx=4)
chess_view.py 文件源码 项目:cpsc415 作者: WheezePuppet 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, root):
        self.game = chess_model.game
        self.do_replay = False

        # photo_images: the PhotoImage objects, one per *type* of piece, that
        # are loaded from disk.
        self.photo_images = {}

        # displayed_images: the actual individual displayed spites, one per
        # *piece*, that are each positioned on an actual square.
        self.displayed_images = {}

        self.custom_font = tkFont.Font(family="{Times}",size=16)
        self.bigger_font = tkFont.Font(family="{Times}",size=20)
        self.root = root
        self.root.title("Stephen's Crazy Chess")
        self.root.bind('<Return>', self.start_game)
        self.top = ttk.Frame(self.root)
        self.top.pack()
        self.setup()
        self._drag_stuff = {'x': 0, 'y': 0, 'piece': None}
        self.center()
mod_detector.py 文件源码 项目:Quiver 作者: DeflatedPickle 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, **kwargs):
        ttk.Frame.__init__(self, parent, **kwargs)
        self.parent = parent
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.widget_tree = ttk.Treeview(self, selectmode="browse", columns=[""])
        self.widget_tree.grid(row=0, column=0, sticky="nesw")

        self.widget_tree.configure(selectmode="browse")
        self.widget_tree.heading("#0", text="Mod Name")
        self.widget_tree.heading("#1", text="Mod Extension")
        self.widget_tree.column("#1", width=100, stretch=False)

        self.scrollbar_horizontal = ttk.Scrollbar(self, orient="horizontal", command=self.widget_tree.xview)
        self.scrollbar_horizontal.grid(row=1, column=0, sticky="we")

        self.scrollbar_vertical = ttk.Scrollbar(self, orient="vertical", command=self.widget_tree.yview)
        self.scrollbar_vertical.grid(row=0, column=1, sticky="ns")

        self.widget_tree.configure(xscrollcommand=self.scrollbar_horizontal.set,
                                   yscrollcommand=self.scrollbar_vertical.set)
dialog.py 文件源码 项目:Quiver 作者: DeflatedPickle 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def body(self, master):
        TreeDialog.body(self, master)

        frame = ttk.Frame(master)
        frame.pack(side="right")

        frame_one = ttk.Frame(frame)
        frame_one.pack(pady=5)

        add = ttk.Button(frame_one, text="Add Pack")
        add.pack()

        remove = ttk.Button(frame_one, text="Remove Pack")
        remove.pack()

        frame_two = ttk.Frame(frame)
        frame_two.pack(pady=5)

        enable = ttk.Button(frame_two, text="Enable Pack")
        enable.pack()

        disable = ttk.Button(frame_two, text="Disable Pack")
        disable.pack()
infobar.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, parent, title="", title_command=None, info="", info_command=None, background="SystemButtonFace", *args):
        ttk.Frame.__init__(self, parent, *args)
        self.parent = parent
        self._title = title
        self._title_command = title_command
        self._info = info
        self._info_command = info_command
        self._background = background

        self.columnconfigure(1, weight=1)

        style = ttk.Style()
        style.configure("InfoBar.Toolbutton", background=self._background)
        style.configure("InfoClose.InfoBar.Toolbutton", anchor="center")

        if self._title != "":
            self._title_button = ttk.Button(self, text=self._title, style="InfoBar.Toolbutton", command=self._title_command)
            self._title_button.grid(row=0, column=0)

        self._info_button = ttk.Button(self, text=self._info, style="InfoBar.Toolbutton", command=self._info_command)
        self._info_button.grid(row=0, column=1, sticky="we")

        self._close_button = ttk.Button(self, text="x", width=2, style="InfoClose.InfoBar.Toolbutton", command=self.close)
        self._close_button.grid(row=0, column=2)
toggledlabelframe.py 文件源码 项目:pkinter 作者: DeflatedPickle 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, parent, on_text="Active", off_text="Inactive", default_state=False, state="enabled", *args):
        ttk.LabelFrame.__init__(self, parent, labelanchor="n", *args)
        self.parent = parent
        self._on_text = on_text
        self._off_text = off_text
        self._default_state = default_state
        self._state = state

        self._fill = tk.Frame(self, height=5)

        self._variable = tk.IntVar()
        self._variable.set(default_state)

        self._button = ttk.Checkbutton(self, width=11, state=self._state, variable=self._variable, command=self._activate, style="TButton")
        self.configure(labelwidget=self._button)

        self.frame = ttk.Frame(self)

        self._activate()
gui.py 文件源码 项目:skan 作者: jni 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def create_parameters_frame(self, parent):
        parameters = ttk.Frame(master=parent, padding=STANDARD_MARGIN)
        parameters.grid(sticky='nsew')

        heading = ttk.Label(parameters, text='Analysis parameters')
        heading.grid(column=0, row=0, sticky='n')

        for i, param in enumerate(self.parameters, start=1):
            param_label = ttk.Label(parameters, text=param._name)
            param_label.grid(row=i, column=0, sticky='nsew')
            if type(param) == tk.BooleanVar:
                param_entry = ttk.Checkbutton(parameters, variable=param)
            elif hasattr(param, '_choices'):
                param_entry = ttk.OptionMenu(parameters, param, param.get(),
                                             *param._choices.keys())
            else:
                param_entry = ttk.Entry(parameters, textvariable=param)
            param_entry.grid(row=i, column=1, sticky='nsew')
tkcalendar.py 文件源码 项目:tk_tools 作者: slightlynybbled 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __place_widgets(self):
        # header frame and its widgets
        hframe = tkinter.ttk.Frame(self)
        lbtn = tkinter.ttk.Button(hframe,
                                  style='L.TButton',
                                  command=self._prev_month)
        rbtn = tkinter.ttk.Button(hframe,
                                  style='R.TButton',
                                  command=self._next_month)
        self._header = tkinter.ttk.Label(hframe, width=15, anchor='center')
        # the calendar
        self._calendar = tkinter.ttk.Treeview(self, show='',
                                              selectmode='none', height=7)

        # pack the widgets
        hframe.pack(in_=self, side='top', pady=4, anchor='center')
        lbtn.grid(in_=hframe)
        self._header.grid(in_=hframe, column=1, row=0, padx=12)
        rbtn.grid(in_=hframe, column=2, row=0)
        self._calendar.pack(in_=self, expand=1, fill='both', side='bottom')
taskbar.py 文件源码 项目:Colony 作者: DeflatedPickle 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, parent, game, **kwargs):
        ttk.Frame.__init__(self, parent, **kwargs)
        self.parent = parent
        self.game = game

        self.add_button("Construction")

        self.menu_colonists = menus.MenuColonists(self)
        self.add_button("Colonists", self.menu_colonists)

        self.add_button("Animals")
        self.add_button("Wildlife")

        self.menu_relationships = menus.MenuRelationships(self)
        self.add_button("Relationships", self.menu_relationships)

        if self.parent.variable_debug.get():
            self.menu_debug = menus.MenuDebug(self)
            self.add_button("Debug", self.menu_debug)

        self.option_menu = menus.MenuOptions(self)
        self.add_button("Menu", self.option_menu)
window.py 文件源码 项目:Colony 作者: DeflatedPickle 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, parent, *args, **kwargs):
        tk.Toplevel.__init__(self, parent, *args, **kwargs)
        self.parent = parent
        self.resizable(False, False)
        self.geometry("200x250")
        self.transient(parent)
        self.grab_set()

        self.current_row = 0

        self.frame_widget = ttk.Frame(self)
        self.frame_widget.pack(fill="both", expand=True)
        self.frame_widget.rowconfigure(0, weight=1)
        self.frame_widget.columnconfigure(0, weight=1)

        self.frame_buttons = ttk.Frame(self)
        self.frame_buttons.pack(fill="x")
        ttk.Button(self.frame_buttons, text="Close", command=self.close).pack(side="left")

        self.parent.bind("<Configure>", self.center)
        self.protocol("WM_DELETE_WINDOW", self.close)

        self.center()
exe.py 文件源码 项目:schick-data-gui 作者: tuxor1337 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, master, schick_reader):
        ttk.Frame.__init__(self, master)

        self.schick_reader = schick_reader
        self.index = self.schick_reader.vars

        self.v_name = StringVar()
        self.v_type = StringVar()

        lbl = ttk.Label(self, textvariable=self.v_name, font="bold")
        lbl2 = ttk.Label(self, textvariable=self.v_type)
        self.v_comment = Text(self, height=5, width=100)
        self.v_hex = Text(self, height=20, width=63, padx=10, pady=10)

        lbl.grid(column=0, row=0, padx=10, pady=5, sticky=(N,W))
        lbl2.grid(column=0, row=1, padx=10, pady=5, sticky=(N,W))
        self.v_comment.grid(column=0, row=2, padx=10, pady=5, sticky=(N,W))
        self.v_hex.grid(column=0, row=3, padx=10, pady=5, sticky=(N,S))
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(3, weight=1)

        self.v_name.set('')
        self.v_type.set('')
extra.py 文件源码 项目:schick-data-gui 作者: tuxor1337 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, master, schick_reader):
        ttk.Frame.__init__(self, master)

        self.schick_reader = schick_reader
        self.index = ["Routes", "Travel events"]

        self.contents = {
            "Routes": SchickXRoutesContent(self, self.schick_reader),
            "Travel events": SchickXTEventsContent(self, self.schick_reader)
        }

        self.v_name = StringVar()
        self.content = None

        lbl = ttk.Label(self, textvariable=self.v_name, font="bold")

        lbl.grid(column=0, row=0, padx=10, pady=5, sticky=(N,W))
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(1, weight=1)

        self.v_name.set('')
dat_extra.py 文件源码 项目:schick-data-gui 作者: tuxor1337 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, master, schick_reader, fname, page=0):
        ttk.Frame.__init__(self, master)

        self.page = page
        self.schick_reader = schick_reader

        self.canvas = Canvas(self, height=8*16*1.5)
        self.lbox = FilteredListbox(self, listvariable=[], height=15)

        self.canvas.grid(row=0, column=0, pady=5, sticky=(N,E,S,W))
        self.lbox.grid(row=1, column=0, sticky=(N,E,S,W))
        self.grid_rowconfigure(1, weight=1)
        self.grid_columnconfigure(0, weight=1)

        self.canvas.bind("<Configure>", self.on_resize)
        self.lbox.bind("<<ListboxSelect>>", self.select_loc_cb)

        self.images, self.loctab = self.schick_reader.read_archive_map_file(fname)
        for img in self.images: img["bak"] = img["rgb"].copy()
        self.max_pages = len(self.images)
        self.filter_loctab(self.page)
        self.show_image(self.page)
dat_extra.py 文件源码 项目:schick-data-gui 作者: tuxor1337 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, master, schick_reader, fname, page=0):
        ttk.Frame.__init__(self, master)

        self.schick_reader = schick_reader

        self.canvas = Canvas(self)
        s = Scrollbar(self)
        self.canvas.config(yscrollcommand=s.set)
        s.config(command=self.canvas.yview)

        s.grid(row=0, column=1, sticky=(N,S))
        self.canvas.grid(row=0, column=0, sticky=(N,E,S,W))
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)

        self.canvas.bind("<Configure>", self.on_resize)

        self.images, self.max_pages = self.schick_reader.read_archive_nvf_file(fname, page)
        self.show_images()
layout.py 文件源码 项目:BioDataSorter 作者: BioDataSorter 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self, parent, controller, *args, **kwargs):
        super().__init__(parent)
        Frame.__init__(self, parent, *args, **kwargs)
        self.controller = controller

        info_image = ".\images\Information.png"
        self.b1, self.photo = self.button_from_label("Info",
                                                     info_image,
                                                     self.info_button,
                                                     "Get information and help"
                                                     " about new features")
        self.b1.grid(row=0, padx=(20, 0), pady=15)

        self.b2, self.photo2 = self.button_from_label("New",
                                                      ".\images\Search.png",
                                                      self.new_button,
                                                      "Process another input "
                                                      "file to get citations.")
        self.b2.grid(row=1, padx=(20, 0), pady=15)
pastebin.py 文件源码 项目:porcupine 作者: Akuli 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def make_please_wait_window(self):
        window = self.please_wait_window = tkinter.Toplevel()
        window.transient(porcupine.get_main_window())
        window.title("Pasting...")
        window.geometry('350x150')
        window.resizable(False, False)

        # disable the close button, there's no good way to cancel this
        # forcefully :(
        window.protocol('WM_DELETE_WINDOW', (lambda: None))

        content = ttk.Frame(window)
        content.pack(fill='both', expand=True)

        label = ttk.Label(
            content, font=('', 12, ''),
            text=("Pasting to %s, please wait..." % self.pastebin_name))
        label.pack(expand=True)

        progressbar = ttk.Progressbar(content, mode='indeterminate')
        progressbar.pack(fill='x', padx=15, pady=15)
        progressbar.start()
trainingwidget.py 文件源码 项目:PyTouch 作者: mNisblee 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, master, **kwargs):
        super().__init__(master, **kwargs)

        self.content_frame = ttk.Frame(self)
        self.lb_title = ttk.Label(self.content_frame, text='Lesson paused')
        self.button_frame = ttk.Frame(self.content_frame)
        self.bt_continue = ttk.Button(self.button_frame, text='Continue', default='active', command=self.on_continue)
        self.bt_restart = ttk.Button(self.button_frame, text='Restart')
        self.bt_abort = ttk.Button(self.button_frame, text='Abort')

        self.content_frame.grid(column=0, row=0)
        self.lb_title.grid(column=0, row=0, pady=3)
        self.button_frame.grid(column=0, row=1, pady=10)
        self.bt_continue.grid(column=0, row=1, pady=3)
        self.bt_restart.grid(column=0, row=2, pady=3)
        self.bt_abort.grid(column=0, row=3, pady=3)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        self.focus_set()
extra_ui.py 文件源码 项目:LadderiLogical 作者: mikadam 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self,root,app):
        ttk.Frame.__init__(self, root)
        self.root=root
        self.app=app

        self.tool="select"

        self.select=ttk.Button(master=self,text="Select",command=lambda:self.change_tool("select"))
        self.horizontal=ttk.Button(master=self,text="Horizontal",command=lambda:self.change_tool("horizontal"))
        self.hswitch=ttk.Button(master=self,text="HSwitch",command=lambda:self.change_tool("hswitch"))
        self.delete=ttk.Button(master=self,text="Delete",command=lambda:self.change_tool("delete"))
        self.flag=ttk.Button(master=self,text="Flag",command=lambda:self.change_tool("flag"))
        self.auto=ttk.Button(master=self,text="Auto",command=lambda:self.change_tool("auto"))


        self.select.grid(row=0,column=0)
        self.auto.grid(row=0,column=1)
        self.delete.grid(row=0,column=2)
        self.horizontal.grid(row=0,column=3)
        self.hswitch.grid(row=0,column=4)
        self.flag.grid(row=0,column=5)
box.py 文件源码 项目:synthesizer 作者: irmen 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, app, master):
        super().__init__(master, text="Effects/Samples - shift+click to assign sample", padding=4)
        self.app = app
        self.effects = {num: None for num in range(16)}
        f = ttk.Frame(self)
        self.buttons = []
        for i in range(1, 9):
            b = ttk.Button(f, text="# {:d}".format(i), width=14, state=tk.DISABLED)
            b.bind("<ButtonRelease>", self.do_button_release)
            b.effect_nr = i
            b.pack(side=tk.LEFT)
            self.buttons.append(b)
        f.pack()
        f = ttk.Frame(self)
        for i in range(9, 17):
            b = ttk.Button(f, text="# {:d}".format(i), width=14, state=tk.DISABLED)
            b.bind("<ButtonRelease>", self.do_button_release)
            b.effect_nr = i
            b. pack(side=tk.LEFT)
            self.buttons.append(b)
        f.pack()
        self.after(2000, lambda: Pyro4.Future(self.load_settings)(True))
GUI.py 文件源码 项目:PyTasks 作者: TheHirschfield 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        Frame.__init__(self, parent)

        #Get Current Calender States
        firstDay = calendar.MONDAY
        year = self.datetime.now().year
        month = self.datetime.now().month
        selectedBg = '#9bc0d9' # Previous - 84b5d3
        selectedFg = '#ffffff'

        self.date = self.datetime(year,month,1)
        self.selected = None
        self.currentTime = ""


        self.cal = getCalendar(None,firstDay)

        self.parent = parent
        self.initUI()

        #Main Calender Widget
        self.calenderStyleWidget()
        self.calenderPlaceWidget()
        self.calenderConfig()

        self.setupSelected(selectedBg, selectedFg)

        self.items = [self.calenderMainView.insert('', 'end', values='') for _ in range(6)]

        self.calenderMake()
        self.calenderMainView.bind('<Map>',self.minsize)

        #Add Events Listing Tabs
        self.eventViewerPlace()

    #Main Window Creation
GUI.py 文件源码 项目:PyTasks 作者: TheHirschfield 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def calenderPlaceWidget(self):
        #Header Frame
        calenderFrame = ttk.Frame(self)
        leftMonthChangeButton = ttk.Button(calenderFrame, style='L.TButton', command=self.setPreviousMonth)
        rightMonthChangeButton = ttk.Button(calenderFrame, style='R.TButton', command=self.setNextMonth)
        self.calenderHeader = ttk.Label(calenderFrame, width=15, anchor='center')
        self.calenderMainView = ttk.Treeview(show='', selectmode='none', height=7, style='Calendar.Treeview')

        #Pack Header
        calenderFrame.pack(in_=self, side='top', pady=4, anchor='center')
        leftMonthChangeButton.grid(in_=calenderFrame)
        self.calenderHeader.grid(in_=calenderFrame, column=1, row=0, padx=12)
        rightMonthChangeButton.grid(in_=calenderFrame, column=2, row=0)
        self.calenderMainView.pack(in_=self, fill='x', side='top')
GUI.py 文件源码 项目:PyTasks 作者: TheHirschfield 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def eventViewerPlace(self):
        eventViewerFrame = ttk.Frame(self)               
        eventViewerFrame.pack(in_=self, side='top',fill='both', expand='Y')

        self.eventMainView = ttk.Notebook(eventViewerFrame, name='notebook')

        #Event Tab Text Box - Tab 0
        tab0 = ttk.Frame(self.eventMainView)
        self.eventMainView.add(tab0, text="Tasks")

        self.eventMainView.pack(fill='both', expand=Y, side='top')

        self.eventsBox = Text(tab0, wrap=WORD, width=40, height=10)
        self.eventsBox.pack(fill=BOTH, expand=Y)

        #self.eventsBox.config(state=DISABLED)


        #Note Tab Text Box - Tab 1
        tab1 = ttk.Frame(self.eventMainView)
        self.eventMainView.add(tab1, text="Notes")

        self.eventMainView.pack(fill='both', expand=Y, side='top')

        self.notesBox = Text(tab1, wrap=WORD, width=40, height=10)
        vscroll = ttk.Scrollbar(tab1, orient=VERTICAL, command=self.notesBox.yview)
        self.notesBox['yscroll'] = vscroll.set
        vscroll.pack(side=RIGHT, fill=Y)
        self.notesBox.pack(fill=BOTH, expand=Y)
gui.py 文件源码 项目:modis 作者: Infraxion 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        super(Frame, self).__init__(parent)

        logger.debug("Initialising frame")
_ui.py 文件源码 项目:modis 作者: Infraxion 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """Send messages from the bot

        Args:
            parent:
        """

        super(ChatFrame, self).__init__(parent, padding=8, text="Chat")

        self.channel = tk.StringVar()
        self.message = tk.StringVar()

        self.channel_frame = ttk.Frame(self)
        self.channel_frame.grid(column=0, row=0, sticky="W E")
        self.channel_label = ttk.Label(self.channel_frame, text="Channel ID:")
        self.channel_label.grid(column=0, row=0, sticky="W E")
        self.channel_box = ttk.Entry(self.channel_frame, textvariable=self.channel)
        self.channel_box.grid(column=0, row=1, sticky="W E")
        self.channel_frame.columnconfigure(0, weight=1)

        self.message_frame = ttk.Frame(self)
        self.message_frame.grid(column=0, row=1, pady=8, sticky="W E")
        self.message_label = ttk.Label(self.message_frame, text="Message:")
        self.message_label.grid(column=0, row=0, sticky="W E")
        self.message_box = ttk.Entry(self.message_frame, textvariable=self.message)
        self.message_box.grid(column=0, row=1, sticky="W E")
        self.message_frame.columnconfigure(0, weight=1)

        self.send_button = ttk.Button(self, command=lambda: self.add_current_message(), text="Send")
        self.send_button.grid(column=0, row=2, sticky="W")

        self.columnconfigure(0, weight=1)
_ui.py 文件源码 项目:modis 作者: Infraxion 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """
        Create a new UI for the module

        Args:
            parent: A tk or ttk object
        """

        super(ModuleUIFrame, self).__init__(parent)
        self.columnconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)

        # Set default values
        from ....datatools import get_data
        data = get_data()

        # API Frame
        api_frame = ttk.LabelFrame(self, padding=8, text="Google API")
        api_frame.grid(row=0, column=0, sticky="W E N S")
        api_frame.columnconfigure(0, weight=1)
        # Add key fields
        self.google_api_key = tk.StringVar()
        ttk.Label(api_frame, text="Google API Key").grid(column=0, row=0, sticky="W E N S")
        ttk.Entry(api_frame, textvariable=self.google_api_key).grid(
            column=0, row=1, padx=0, pady=4, sticky="W E N S")
        self.soundcloud_client_id = tk.StringVar()
        ttk.Label(api_frame, text="SoundCloud Client ID").grid(column=0, row=2, sticky="W E N S")
        ttk.Entry(api_frame, textvariable=self.soundcloud_client_id).grid(
            column=0, row=3, padx=0, pady=4, sticky="W E N S")
        ttk.Button(api_frame, command=lambda: self.update_keys(), text="Update API Data").grid(
            column=0, row=4, padx=0, pady=4, sticky="W E N S")

        if "google_api_key" in data["discord"]["keys"]:
            self.google_api_key.set(data["discord"]["keys"]["google_api_key"])
        if "soundcloud_client_id" in data["discord"]["keys"]:
            self.soundcloud_client_id.set(data["discord"]["keys"]["soundcloud_client_id"])


问题


面经


文章

微信
公众号

扫码关注公众号