本文整理汇总了Python中ttk.Style类的典型用法代码示例。如果您正苦于以下问题:Python Style类的具体用法?Python Style怎么用?Python Style使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Style类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: Example
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)
开发者ID:griadooss,项目名称:HowTos,代码行数:34,代码来源:05_buttons.py
示例2: AutoAim
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)
开发者ID:stanford-ssi,项目名称:opt-comms,代码行数:34,代码来源:AutoAimBasicV2.py
示例3: Example
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')
开发者ID:Millzombie,项目名称:Python-programming,代码行数:30,代码来源:project.py
示例4: initUI
def initUI(self):
self.parent.title("Absolute positioning")
self.pack(fill=BOTH, expand=1)
style = Style()
style.configure("TFrame", background="#333")
bard = Image.open("bardejov.jpg")
bardejov = ImageTk.PhotoImage(bard)
#We create an image object and a photo image object from an image in the current working directory.
label1 = Label(self, image=bardejov)
#We create a Label with an image. Labels can contain text or images.
label1.image = bardejov
#We must keep the reference to the image to prevent image from being garbage collected.
label1.place(x=20, y=20)
#The label is placed on the frame at x=20, y=20 coordinates.
rot = Image.open("rotunda.jpg")
rotunda = ImageTk.PhotoImage(rot)
label2 = Label(self, image=rotunda)
label2.image = rotunda
label2.place(x=40, y=160)
minc = Image.open("mincol.jpg")
mincol = ImageTk.PhotoImage(minc)
label3 = Label(self, image=mincol)
label3.image = mincol
label3.place(x=170, y=50)
开发者ID:griadooss,项目名称:HowTos,代码行数:29,代码来源:04_layout_management.py
示例5: MainFrame
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"})
开发者ID:Tianwei-Li,项目名称:DS-Bus-Tracker,代码行数:25,代码来源:gui_gsn.py
示例6: Example
class Example(Frame):
def __init__(self,parent):
Frame.__init__(self,parent)
self.parent=parent
self.initUI()
def close_window():
root.destroy()
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)
bard = Image.open("images.jpg")
bardejov = ImageTk.PhotoImage(bard)
label1 = Label(frame, image=bardejov)
label1.image = bardejov
label1.place(x=20, y=20)
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)
开发者ID:shikhagarg0192,项目名称:Python,代码行数:30,代码来源:gui7.py
示例7: Example
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)
开发者ID:jessebwr,项目名称:AISC2,代码行数:27,代码来源:tkinter_tutorial2.py
示例8: Example
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Quit button")
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=50, y=50)
def display_bots:
pass
def
开发者ID:RachaelT,项目名称:UTDchess-RospyXbee,代码行数:25,代码来源:gui.py
示例9: remove_tab_controls
def remove_tab_controls(self):
"""Remove tab area and most tab bindings from this window."""
if TTK:
self.text_notebook['style'] = 'PyShell.TNotebook'
style = Style(self.top)
style.layout('PyShell.TNotebook.Tab', [('null', '')])
else:
self.text_notebook._tab_set.grid_forget()
# remove commands related to tab
if 'file' in self.menudict:
menu = self.menudict['file']
curr_entry = None
i = 0
while True:
last_entry, curr_entry = curr_entry, menu.entryconfigure(i)
if last_entry == curr_entry:
# no more menu entries
break
if 'label' in curr_entry and 'Tab' in curr_entry['label'][-1]:
if 'Close' not in ' '.join(curr_entry['label'][-1]):
menu.delete(i)
i += 1
self.current_page.text.unbind('<<new-tab>>')
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:26,代码来源:EditorWindow.py
示例10: Example
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)
开发者ID:shikhagarg0192,项目名称:Python,代码行数:33,代码来源:gui9.py
示例11: Example
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)
开发者ID:alonsopg,项目名称:tkinter_examples,代码行数:26,代码来源:5_buttons_example.py
示例12: initUI
def initUI(self):
self.parent.title("Absolute positioning")
self.pack(fill=BOTH, expand=1)
style = Style()
style.configure("TFrame", background="#333")
开发者ID:mull3rcw,项目名称:python_mt_unitTest,代码行数:7,代码来源:agui.py
示例13: KnnFrame
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)
开发者ID:tifoit,项目名称:knn-1,代码行数:27,代码来源:knn.py
示例14: DialogScale
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()
开发者ID:gaetanbahl,项目名称:TIPE2013-2014,代码行数:32,代码来源:ondelettesGUI.py
示例15: Example
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Message boxes")
self.style = Style()
self.style.theme_use("default")
self.pack()
error = Button(self, text="Error", command=self.onError)
error.grid()
warning = Button(self, text="Warning", command=self.onWarn)
warning.grid(row=1, column=0)
question = Button(self, text="Question", command=self.onQuest)
question.grid(row=0, column=1)
inform = Button(self, text="Information", command=self.onInfo)
inform.grid(row=1, column=1)
def onError(self):
box.showerror("Error", "Could not open file")
def onWarn(self):
box.showwarning("Warning", "Deprecated function call")
def onQuest(self):
box.askquestion("Question", "Are you sure to quit?")
def onInfo(self):
box.showinfo("Information", "Download completed")
开发者ID:kilirobbs,项目名称:python-fiddle,代码行数:35,代码来源:dialog.py
示例16: TK_Framework
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
开发者ID:ncsurobotics,项目名称:acoustics,代码行数:29,代码来源:gui_lib.py
示例17: Example
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)
开发者ID:kingraijun,项目名称:zetcode-tuts,代码行数:30,代码来源:scale.py
示例18: MainFrame
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)
开发者ID:nshaud,项目名称:content-recommendation,代码行数:31,代码来源:content_recommendation.py
示例19: myApp
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)
开发者ID:iosonosempreio,项目名称:getsorted,代码行数:28,代码来源:ex1.py
示例20: CommAdd
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
开发者ID:angelalonso,项目名称:comm,代码行数:35,代码来源:comm.py
注:本文中的ttk.Style类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论