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


Python ttk.Style类代码示例

本文整理汇总了Python中tkinter.ttk.Style的典型用法代码示例。如果您正苦于以下问题:Python Style类的具体用法?Python Style怎么用?Python Style使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: MainWindow

class MainWindow(Frame):
    """
    Macro class for the main program window
    """
    def __init__(self, parent):

        Frame.__init__(self, parent)

        self.parent = parent
        self.parent.title('PyNBTx %s' % __version__)

        self.style = Style()
        self.style.theme_use('default')
        self.style.configure('TButton', padding=0)

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

        self.menu = MainMenu(root)
        self.toolbar = ToolBar(self)
        self.tree = Treeview(self, height=20)
        self.tree_display = TreeDisplay(self.tree)

        self.ui_init()

    def ui_init(self):
        root['menu'] = self.menu
        self.toolbar.pack(anchor=NW, padx=4, pady=4)
        self.tree.column('#0', width=300)
        self.tree.pack(fill=BOTH, anchor=NW, padx=4, pady=4)
开发者ID:ievans3024,项目名称:PyNBTx,代码行数:29,代码来源:__init__.py

示例2: __init__

class About:
    def __init__(self, parent):
        self.parent = parent

        self.style = Style()
        self.style.theme_use('clam')

        self.root = Toplevel()
        self.root.title('pyEdit - About')
        self.root.resizable(False, False)
        self.root.minsize(200, 50)
        self.root.columnconfigure(0, weight=1)

        self.root.bind('<Expose>', lambda e: Utils.on_expose(self))
        self.root.wm_protocol('WM_DELETE_WINDOW', lambda: Utils.on_close(self))

        self.label_app_name = Label(self.root, text='pyEdit (Lightweight IDE)')
        self.label_app_name.grid(column=0, row=0, sticky='nsew', ipadx=5, ipady=5)

        self.label_author = Label(self.root, text='Author: Marek Kouřil')
        self.label_author.grid(column=0, row=1, sticky='nsew', ipadx=5, ipady=5)

        self.label_year = Label(self.root, text='2016')
        self.label_year.grid(column=0, row=2, sticky='nsew', ipadx=5, ipady=5)

        self.label_course = Label(self.root, text='\'URO\' course')
        self.label_course.grid(column=0, row=3, sticky='nsew', ipadx=5, ipady=5)
开发者ID:cmoud94,项目名称:pyEdit,代码行数:27,代码来源:About.py

示例3: MainWindow

class MainWindow(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.grid()
        self.init_ui()
        self.wallhandler = WallHandler()
        self.reddit = Reddit()

    def init_ui(self):
        self.parent.title("Papers")
        self.style = Style()
        self.style.theme_use("clam")
        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.grid(row=0, column=0)
        label = Label(frame, text="Change Wallpaper")
        label.grid(row=0, column=0)
        button = Button(frame, text="Change", command=self.change)
        button.grid(row=1, column=0)
        label = Label(frame, text="Fetch Wallpapers")
        label.grid(row=2, column=0)
        button = Button(frame, text="Fetch", command=self.fetch)
        button.grid(row=3, column=0)

    def change(self):
        self.wallhandler.run()

    def fetch(self):
        self.reddit.run()
开发者ID:jflowaa,项目名称:papers,代码行数:29,代码来源:paper_gui.py

示例4: __init__

    def __init__(self, parent):
        Notebook.__init__(self, parent, style='Type.TNotebook')
        logger = logging.getLogger(__name__)

        s = Style()
        s.configure('Type.TNotebook', tabposition="se")
        
        self.page_tiborcim = Frame(self)
        self.page_python = Frame(self)
        self.add(self.page_tiborcim, text='Tiborcim')
        self.add(self.page_python, text='Python')

        self.text_tiborcim = CimTiborcimText(self.page_tiborcim, self)

        self.vbar_python = Scrollbar(self.page_python, name='vbar_python')
        self.xbar_python = Scrollbar(self.page_python, name='xbar_python', orient="horizontal")
        self.text_python = Text(self.page_python, wrap="none", state="disabled", borderwidth='0p')
        self.vbar_python['command'] = self.text_python.yview
        self.vbar_python.pack(side="right", fill="y")
        self.text_python['yscrollcommand'] = self.vbar_python.set
        self.xbar_python['command'] = self.text_python.xview
        self.xbar_python.pack(side="bottom", fill="x")
        self.text_python['xscrollcommand'] = self.xbar_python.set
        self.text_python.pack(expand=1, fill="both")

        self.viewmode = "tiborcim"
        self.saved = True
        self.filename = None
开发者ID:ZanderBrown,项目名称:Tiborcim,代码行数:28,代码来源:cim.py

示例5: set_theme_defaults

 def set_theme_defaults(cls, master, theme_name='default', style_name=None):
     style = Style(master)
     if style_name is None:
         style_name = cls.STYLE_NAME
     style.theme_settings(theme_name, {
         style_name: cls.STYLE_DEFAULTS
     })
开发者ID:talflon,项目名称:alho-py,代码行数:7,代码来源:util.py

示例6: __init__

 def __init__(self, widget):
     self.widget = widget
     self.widget.bind("<Enter>", self.show)
     self.widget.bind("<Leave>", self.hide)
     self.tooltip = None
     style = Style()
     style.configure("tt.TLabel", background="#fbfbf4", foreground="#333333")
开发者ID:jwdafoe,项目名称:ContactPro,代码行数:7,代码来源:gui.py

示例7: Main

class Main(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.info = {}
        self.window = None
        self.size = (640, 480)
        self.fields = []
        self.init_ui()

    def init_ui(self):
        self.parent.title("Node Writer")
        self.style = Style()
        self.style.theme_use("alt")
        self.pack(fill="both", expand=True)

        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)
        menubar.add_command(label="New", command=self.onNew)
        menubar.add_command(label="Show Info", command=self.get_info)
        menubar.add_command(label="Exit", command=self.quit)

        self.canvas = Canvas(self, background="white", width=self.size[0], height=self.size[1])
        self.canvas.pack(fill="both", expand=1)
        self.canvas.bind("<Motion>", self.move_boxes)

    def move_boxes(self, event):
        print(event.x, event.y)
        """
        x, y = (event.x-1, event.y-1)
        x1, y1, x2, y2 = self.canvas.bbox("test")
        if x > x1 and y > y1 and x < x2 and y < y2:
            print("Hit")
        else:
            print("Missed")
        """

    def onNew(self):
        new = Node(self, "Node_entry")
        label = new.insert_entry_field("Labels")
        label2 = new.insert_entry_field("Labels2")
        text = new.insert_text_field("Text")
        new.ok_cancel_buttons()

    def get_info(self):
        x, y = (self.size[0]/2, self.size[1]/2)
        for i in self.info:
            label_frame= LabelFrame(self, text="name")
            label_frame.pack(fill="y")
            for entry in self.info[i]["Entry"]:
                frame = Frame(label_frame)
                frame.pack(fill="x")
                label = Label(label_frame, text=self.info[i]["Entry"][entry], width=6)
                label.pack(side="left", anchor="n", padx=5, pady=5)
            for text in self.info[i]["Text"]:
                frame = Frame(label_frame)
                frame.pack(fill="x")
                label = Label(label_frame, text=self.info[i]["Text"][text], width=6)
                label.pack(side="left", anchor="n", padx=5, pady=5)
        window = self.canvas.create_window(x, y, window=label_frame, tag="test")
开发者ID:Exodus111,项目名称:Projects,代码行数:60,代码来源:main.py

示例8: __init__

 def __init__(self, title="", message="", button="Ok", image=None,
              checkmessage="", style="clam", **options):
     """
         Create a messagebox with one button and a checkbox below the button:
             parent: parent of the toplevel window
             title: message box title
             message: message box text
             button: message displayed on the button
             image: image displayed at the left of the message
             checkmessage: message displayed next to the checkbox
             **options: other options to pass to the Toplevel.__init__ method
     """
     Tk.__init__(self, **options)
     self.resizable(False, False)
     self.title(title)
     s = Style(self)
     s.theme_use(style)
     if image:
         Label(self, text=message, wraplength=335,
               font="Sans 11", compound="left",
               image=image).grid(row=0, padx=10, pady=(10, 0))
     else:
         Label(self, text=message, wraplength=335,
               font="Sans 11").grid(row=0, padx=10, pady=(10, 0))
     b = Button(self, text=button, command=self.destroy)
     b.grid(row=2, padx=10, pady=10)
     self.var = BooleanVar(self)
     c = Checkbutton(self, text=checkmessage, variable=self.var)
     c.grid(row=1, padx=10, pady=0, sticky="e")
     self.grab_set()
     b.focus_set()
     self.wait_window(self)
开发者ID:j4321,项目名称:Sudoku-Tk,代码行数:32,代码来源:custom_messagebox.py

示例9: main

def main():
    ''' Runs main application GUI.
    '''
    logger = get_logger()
    logger.info('pyDEA started as a GUI application.')

    root = Tk()

    root.report_callback_exception = show_error

    # load logo
    if "nt" == os.name:
        iconfile = pkg_resources.resource_filename(PACKAGE, 'pyDEAlogo.ico')
        root.wm_iconbitmap(bitmap=iconfile)
    else:
        iconfile = pkg_resources.resource_filename(PACKAGE, 'pyDEAlogo.gif')
        img = PhotoImage(file=iconfile)
        root.tk.call('wm', 'iconphoto', root._w, img)

    # change background color of all widgets
    s = Style()
    s.configure('.', background=bg_color)

    # run the application
    app = MainFrame(root)
    root.protocol("WM_DELETE_WINDOW", (lambda: ask_quit(app)))

    center_window(root,
                  root.winfo_screenwidth() - root.winfo_screenwidth()*0.15,
                  root.winfo_screenheight() - root.winfo_screenheight()*0.15)

    root.mainloop()
    logger.info('pyDEA exited.')
开发者ID:nishimaomaoxiong,项目名称:pyDEA,代码行数:33,代码来源:main_gui.py

示例10: create_frame

 def create_frame(self):
     frame_style = Style()
     frame_style.theme_use('alt')
     frame_style.configure("TFrame",
                           relief='raised')
     self.frame = Frame(self.window, style="frame_style.TFrame")
     self.frame.rowconfigure(1)
     self.frame.columnconfigure(1)
     self.frame.grid(row=0, column=0)
开发者ID:jacob-carrier,项目名称:code,代码行数:9,代码来源:recipe-580650.py

示例11: poly_pocket

class poly_pocket(Frame):
    def __init__(self):
        window = Tk()
        self.parent = window
        window.geometry("800x600+50+50")
        Frame.__init__(self, window)
        self.baseline = 0
        self.initUI()
        window.mainloop()
    def initUI(self):
        # Initialize and name Window
        self.parent.title("Poly Pocket")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        def new_baseline():

            return
        def old_baseline():
            return
        def test(baseline):
            return
        def spark_connect():
            return
        def leap_connect():
            return
        def quit():
            self.parent.destroy()
            return

        welcome = "Welcome to Poly Pocket!"
        welcome_label = Label(self, text=welcome, font=("Helvetica", 24))
        welcome_label.place(x=5, y=5)
        welcome_label.pack()
        
        baseline_button = Button(self, text="New Baseline",
                command=new_baseline())
        recover_baseline_button = Button(self, text="Recover Baseline",
                command=old_baseline())
        test_button = Button(self, text="Conduct Test",
                command=test(self.baseline))
        connect_leap_button = Button(self, text="Establish Leap Connection",
                command=leap_connect)
        connect_spark_button = Button(self, text="Establish Spark Connection",
                command=spark_connect)
        exit_button = Button(self, text="Quit",
                command=quit)
        
        baseline_button.place(relx=0.5, rely=0.3, anchor=CENTER)
        recover_baseline_button.place(relx=0.5, rely=0.4, anchor=CENTER)
        test_button.place(relx=0.5, rely=0.5, anchor=CENTER)
        connect_leap_button.place(relx=0.5, rely=0.6, anchor=CENTER)
        connect_spark_button.place(relx=0.5, rely=0.7, anchor=CENTER)
        exit_button.place(relx=0.5, rely = 0.8, anchor=CENTER)
开发者ID:AwesomeShayne,项目名称:polypocket,代码行数:55,代码来源:main.py

示例12: initUI

    def initUI(self, mainFrame):
        """initialize the User Interface"""
        
        # styles
        style = Style()
        style.configure("GRN.TLabel", background="#ACF059")
        style.configure("GRN.TFrame", background="#ACF059")
        style.configure("BLK.TFrame", background="#595959")
        
        
        # create top frame
        topFrame = Frame(mainFrame, style="GRN.TFrame", padding=8)
        topFrame.pack(fill=BOTH, side=TOP)
        
        # create black border
        borderFrame = Frame(mainFrame, style="BLK.TFrame")
        borderFrame.pack(fill=BOTH, side=TOP)
        
        # create add player frame
        addPlayerFrame = Frame(mainFrame, padding=8)
        addPlayerFrame.pack(side=TOP)
        
        # create text field for add button
        self.nameFieldVar = StringVar()
        self.playerNameEntry = Entry(addPlayerFrame, textvariable = self.nameFieldVar)
        self.playerNameEntry.pack(side=LEFT)
        # create add player button
        addButton = Button(addPlayerFrame, text="Add player")
        addButton.pack(side=LEFT)
        
        # create choose game list
        self.currentGame = StringVar()
        self.currentGame.set(self.gameList[0])
        gameDropDown = OptionMenu(mainFrame, self.currentGame, self.gameList[0], *self.gameList)
        gameDropDown.pack(side=TOP)

        # create start game button
        startGameButton = Button(mainFrame, text="Start")
        
        startGameButton.bind("<Button-1>", self.startGame)
        startGameButton.pack(side=TOP)
        
        # create label and set text
        self.playerString = StringVar()
        self.playerString.set(self.buildPlayerHeaderString())
        headerLabel = Label(topFrame, textvariable=self.playerString, style="GRN.TLabel")
        headerLabel.pack(side=TOP)     
        addButton.bind("<Button-1>", self.onAddPlayerClick)
        self.playerNameEntry.bind("<Key>", self.onAddPlayerEnter)
        
        #set focus
        self.playerNameEntry.focus()
开发者ID:fi-ka,项目名称:DartScore,代码行数:52,代码来源:ui.py

示例13: __init__

class Help:
    def __init__(self, parent):
        self.parent = parent

        self.style = Style()
        self.style.theme_use('clam')

        self.root = Toplevel()
        self.root.title('pyEdit - Help')
        self.root.resizable(False, False)
        self.root.minsize(200, 50)
        self.root.columnconfigure(0, weight=1)
        self.root.rowconfigure(0, weight=1)

        self.root.bind('<Expose>', lambda e: Utils.on_expose(self))
        self.root.wm_protocol('WM_DELETE_WINDOW', lambda: Utils.on_close(self))

        self.text = self.get_content()

        self.font = font.Font(family='Monospace', size=10, weight='normal')

        self.font_spacing = None
        self.font_spacing = self.font.metrics('descent')

        self.text_widget = Text(self.root,
                                relief='flat',
                                bd=0,
                                font=self.font)
        self.text_widget.grid(column=0, row=0, sticky='nsew')
        self.text_widget.delete('1.0', 'end')
        self.text_widget.insert('1.0', self.text)
        self.text_widget.config(state='disabled')

        self.scrollbar = Scrollbar(self.root, bd=0, orient='vertical', command=self.text_widget.yview)
        self.scrollbar.grid(column=1, row=0, sticky='nsew')
        self.text_widget.config(yscrollcommand=self.scrollbar.set)

    def get_content(self):
        text = ''
        try:
            file = open(self.parent.current_dir + '/help.txt', 'r')
            file.seek(0, 2)
            size = file.tell()
            file.seek(0, 0)
            text = file.read(size)
            file.close()
        except IOError:
            print('IOError while reading help text.')

        return text
开发者ID:cmoud94,项目名称:pyEdit,代码行数:50,代码来源:Help.py

示例14: initUI

    def initUI(self):
        self.parent.title("Windows")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, pad=7)
        self.rowconfigure(6, weight=1)
        self.rowconfigure(5, pad=7)

        lbl = Label(self, text="BookManager")
        lbl.grid(sticky=W, pady=4, padx=5)

        self.area = Text(self) #WHITE TEXT BOX
        self.area.grid(row=1, column=0, columnspan=3, rowspan=4,
            padx=5, sticky=E+W+S+N)

        abtn = Button(self, text="add", command=self.press_add)
        abtn.grid(row=1, column=3)

        srcbtn = Button(self, text="search", command=self.press_search)
        srcbtn.grid(row=2, column=3, pady=3)

        rbtn = Button(self, text="remove", command=self.press_remove)
        rbtn.grid(row=3, column=3, pady=3)

        sbtn = Button(self, text="show all", command=self.press_show)
        sbtn.grid(row=4, column=3, pady=3)
开发者ID:damidam125,项目名称:forPYTHON,代码行数:29,代码来源:make_gui.py

示例15: initUI

    def initUI(self):

        self.parent.title("Windows")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)

        lbl = Label(self, text="Windows")
        lbl.grid(sticky=W, pady=4, padx=5)

        area = Text(self)
        area.grid(row=1, column=0, columnspan=2, rowspan=4, padx=5, sticky=E + W + S + N)

        abtn = Button(self, text="Activate")
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Close")
        cbtn.grid(row=2, column=3, pady=4)

        hbtn = Button(self, text="Help")
        hbtn.grid(row=5, column=0, padx=5)

        obtn = Button(self, text="OK")
        obtn.grid(row=5, column=3)
开发者ID:Austin-Xie,项目名称:python-cave,代码行数:29,代码来源:Window.py


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