本文整理汇总了Python中ttk.Style.theme_use方法的典型用法代码示例。如果您正苦于以下问题:Python Style.theme_use方法的具体用法?Python Style.theme_use怎么用?Python Style.theme_use使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Style
的用法示例。
在下文中一共展示了Style.theme_use方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CommAdd
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class CommAdd(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
# This should be different if running on Windows....
content = pyperclip.paste()
print content
self.entries_found = []
self.parent.title("Add a new command card")
self.style = Style()
self.style.theme_use("default")
self.pack()
self.new_title_label = Label(self, text="Title")
self.new_title_label.grid(row=0, columnspan=2)
self.new_title_entry = Entry(self, width=90)
self.new_title_entry.grid(row=1, column=0)
self.new_title_entry.focus()
self.new_content_label = Label(self, text="Card")
self.new_content_label.grid(row=2, columnspan=2)
self.new_content_text = Text(self, width=110, height=34)
self.new_content_text.insert(END, content)
self.new_content_text.grid(row=3, columnspan=2)
self.add_new_btn = Button(self, text="Add New Card", command=self.onAddNew)
self.add_new_btn.grid(row=4)
def onAddNew(self):
pass
示例2: MainFrame
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class MainFrame(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("GSN Control Panel")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
self.turnOnBtn = Button(self, text="Turn On")
self.turnOnBtn["command"] = self.turnOn
self.turnOnBtn.grid(row=0, column=0)
self.turnOffBtn = Button(self, text="Turn Off")
self.turnOffBtn["command"] = self.turnOff
self.turnOffBtn.grid(row=0, column=1)
def turnOn(self):
host.enqueue({"SM":"GSN_SM", "action":"turnOn", "gsnId":GSNID, "localIP":IP, "localPort":int(PORT)})
def turnOff(self):
host.enqueue({"SM":"GSN_SM", "action":"turnOff"})
示例3: Example
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
#setting up the GUI
def initUI(self):
#sets the title of the window
self.parent.title("Do you dare to Zlatan?")
self.style = Style()
self.style.theme_use("alt")
#creates an object for the window
self.pack(fill=BOTH, expand=1)
#makes buttons
quitButton = Button(self, text="No, Zlatan sucks",
command=self.quit)
quitButton.place(x=30, y=50)
webbutton = Button(self, text="Yes, #DaretoZlatan", command=self.OpenUrl)
webbutton.place(x=130, y=50)
#defines what the buttons do
def quit(self):
self.parent.destroy()
def OpenUrl(self):
webbrowser.open_new('https://www.youtube.com/watch?v=ia-zi5oLa_0')
示例4: Example
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Buttons")
self.style = Style()
self.style.theme_use("default")
frame = Frame(self, relief=RAISED, borderwidth=1)
frame.pack(fill=BOTH, expand=1)
#We create another Frame widget.
#This widget takes the bulk of the area.
#We change the border of the frame so that the frame is visible.
#By default it is flat.
self.pack(fill=BOTH, expand=1)
closeButton = Button(self, text="Close")
closeButton.pack(side=RIGHT, padx=5, pady=5)
#A closeButton is created.
#It is put into a horizontal box.
#The side parameter will create a horizontal box layout, in which the button is placed to the right of the box.
#The padx and the pady parameters will put some space between the widgets.
#The padx puts some space between the button widgets and between the closeButton and the right border of the root window.
#The pady puts some space between the button widgets and the borders of the frame and the root window.
okButton = Button(self, text="OK")
okButton.pack(side=RIGHT)
示例5: myApp
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class myApp(Frame):
def __init__(self, parent):
Frame.__init__(self, parent, background="white")
self.parent = parent
self.initUI()
def initUI(self):
w = self.parent.winfo_screenwidth()/2
h = self.parent.winfo_screenheight()/2
sw = self.parent.winfo_screenwidth()
sh = self.parent.winfo_screenheight()
x = (sw - w)/2
y = (sh - h)/2
self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y))
self.parent.title("myApp")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
quitButton = Button(self, text="Quit",
command=self.quit)
quitButton.place(x=w/2, y=h/2)
示例6: MainFrame
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class MainFrame(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Content recommendation - Test prototype")
self.style = Style()
self.style.theme_use("clam")
self.pack(fill=BOTH, expand=1)
# Create the buttons
quitButton = Button(self, text="Quit", command=self.quit)
quitButton.pack()
global content_seen
content_seen = StringVar()
content_seen.set("0/" + str(MAX_CONTENT))
button = Button(self, text="Show next content", command=lambda: go_next(button, content_seen))
button.pack()
if MAX_CONTENT:
Label(self, textvariable=content_seen).pack()
def quit(self):
if MAX_CONTENT and content_number < MAX_CONTENT:
result = tkMessageBox.askquestion("Quit", "Are you sure ? Your session is incomplete...", icon='warning') == 'yes'
else:
result = True
if result:
stop_detection()
Frame.quit(self)
示例7: Example
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Buttons")
self.style = Style()
self.style.theme_use("default")
#Pack the root frame
self.pack(fill=BOTH, expand=1)
#Create another frame
frame = Frame(self, relief=RAISED, borderwidth=1)
frame.pack(fill=BOTH, expand=1)
#Pack two buttons to the bottom right
closeButton = Button(self, text="Close")
closeButton.pack(side=RIGHT, padx=5, pady=5)
okButton = Button(self, text="OK")
okButton.pack(side=RIGHT)
示例8: Example
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class Example(Frame):
def __init__(self,parent):
Frame.__init__(self,parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("windows widget")
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=3, 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)
示例9: Example
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Buttons")
self.style = Style()
self.style.theme_use("default")
frame = Frame(self, relief=RAISED, borderwidth=1)
frame.pack(fill=BOTH, expand=1)
frame2 = Frame(self, relief=RAISED, borderwidth=2)
frame2.pack(fill=BOTH, expand=1)
self.pack(fill=BOTH, expand=1)
closeButton = Button(self, text="Close")
closeButton.pack(side=RIGHT, padx=5, pady=5)
okButton = Button(self, text="OK")
okButton.pack(side=RIGHT)
示例10: Example
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Scale")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
scale = Scale(self, from_=0, to=100,
command=self.onScale)
scale.pack(side=LEFT, padx=15)
self.var = IntVar()
self.label = Label(self, text=0, textvariable=self.var)
self.label.pack(side=LEFT)
def onScale(self, val):
v = int(float(val))
self.var.set(v)
示例11: AutoAim
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class AutoAim(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.makeButtons()
def makeButtons(self):
self.parent.title("AutoAim")
self.style = Style()
self.style.theme_use("default")
frame = Frame(self, relief=RAISED, borderwidth=1)
frame.pack(fill=BOTH, expand=1)
self.pack(fill=BOTH, expand=1)
# put the option to generate in the bottom and the text entries in the lower left
generate = Button(self, text="Generate", fg="red", command = getEntries)
generate.pack(side=LEFT, padx=30, pady=30)
emailTo = Button(self, text="Save Session", fg="red", command = file_save)
emailTo.pack(side=LEFT, padx=30, pady=30)
# put the option to generate a slow spiral
slow = Button(self, text="Fine", fg="red", command = smallSpiral)
slow.pack(side=RIGHT, padx=10, pady=20)
# put the option to generate a quick spiral
fast = Button(self, text="Coarse", fg="red", command = bigSpiral)
fast.pack(side=RIGHT, padx=10, pady=10)
示例12: Example
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class Example(Frame):
def __init__(self, parent):
# Frame.__init__(self, parent, background="white") #Tkinter Frame
Frame.__init__(self, parent) # ttk Frame
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Drawing Window")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=True)
frameL = Frame(self, relief=RAISED, borderwidth=2)
frameL.pack(fill=BOTH, expand=True)
lbMax = Label(frameL, text="Maximum Arrangment", width=25)
lbMax.pack(side=TOP, padx=5, pady=5)
canvas = Canvas(frameL)
canvas.create_rectangle(30, 10, 120, 80, outline="#fff", fill="#fff")
frameR = Frame(self, relief=RAISED, borderwidth=2)
frameR.pack(fill=BOTH, expand=True)
lbMin = Label(frameR, text="Minimum Arrangment", width=25)
lbMin.pack(side=TOP, padx=5, pady=5)
quitButton = Button(self, text="Quit", command=self.quit)
quitButton.pack(side=RIGHT, padx=10, pady=10)
示例13: KnnFrame
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class KnnFrame(Frame):
def __init__(self, parent):
Frame.__init__(self, parent, background="white")
self.parent = parent
self.style = Style()
self.init_ui()
def center_window(self):
width_knn = 500
height_knn = 500
sw = self.parent.winfo_screenwidth()
sh = self.parent.winfo_screenheight()
x = (sw-width_knn)/2
y = (sh-height_knn)/2
self.parent.geometry('%dx%d+%d+%d' % (width_knn, height_knn, x, y))
def init_ui(self):
self.parent.title("knn - Classification")
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
self.center_window()
quit_button = Button(self, text="Close", command=self.quit)
quit_button.place(x=50, y=50)
示例14: TK_Framework
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class TK_Framework(object):
def __init__(self):
self.root = Tk()
# list of open windows
self.windows = {'main':self.root}
# setup the overall style of the gui
self.style = Style()
self.style.theme_use('clam')
def get_window(self,name):
return self.windows[name]
def create_window(self, name):
self.windows[name] = Toplevel()
@staticmethod
def open_file(init_dir):
filename = askopenfilename(initialdir=init_dir)
return filename
def hide_root(self):
"""Hides the root window"""
self.root.withdraw()
def get_root(self):
return self.root
示例15: DialogScale
# 需要导入模块: from ttk import Style [as 别名]
# 或者: from ttk.Style import theme_use [as 别名]
class DialogScale(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Compression")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
scale = Scale(self, from_=0, to=255,command=self.onScale, orient= HORIZONTAL)
scale.place(x=90, y=20)
self.label2 = Label(self, text="Choisissez un niveau de compression")
self.label2.place(x=52, y=0)
self.quitButton = Button(self, text=" Ok ",command=self.ok)
self.quitButton.place(x=120, y=65)
def onScale(self, val):
self.variable = int(val)
def ok(self):
global compress
compress = self.variable
self.quit()