本文整理汇总了Python中ttk.Button类的典型用法代码示例。如果您正苦于以下问题:Python Button类的具体用法?Python Button怎么用?Python Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Button类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: networkServerUI
def networkServerUI(self):
try:
self.parent.title("Mighty Cracker")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
#load buttons and labels
self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkServerUI_LoadInitUI)
self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
self.networkServerLabel= Label(self, text="Network Server")
self.networkServerLabel.pack(side=TOP, padx=5, pady=5)
self.selectCrackingMethodLabel= Label(self, text="Select Your Cracking Method")
self.selectCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
self.dictionaryCrackingMethodButton= Button(self, text="Dictionary", command=self.unpackNetworkServerUI_LoadNetworkDictionaryUI)
self.dictionaryCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
self.bruteForceCrackingMethodButton= Button(self, text="Brute-Force (default)", command=self.unpackNetwrokServerUI_LoadNetworkBruteForceUI)
self.bruteForceCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
self.rainbowTableCrackingMethodButton= Button(self, text="Rainbow Table", command=self.unpackNetworkServerUI_LoadNetworkRainbowTableUI)
self.rainbowTableCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
except Exception as inst:
print "============================================================================================="
print "GUI ERROR: An exception was thrown in networkServerUI definition Try block"
#the exception instance
print type(inst)
#srguments stored in .args
print inst.args
#_str_ allows args tto be printed directly
print inst
print "============================================================================================="
开发者ID:,项目名称:,代码行数:33,代码来源:
示例2: networkModeUI
def networkModeUI(self):
try:
self.parent.title("Mighty Cracker")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
#load buttons and labels
self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkModeUI_LoadInitUI)
self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
self.networkModeLabel= Label(self, text="Network Mode: Server/Client Selection Screen")
self.networkModeLabel.pack(side=TOP, padx=5, pady=5)
self.selectNetworkModuleLabel= Label(self, text="Select Server or Client")
self.selectNetworkModuleLabel.pack(side=TOP, padx=5, pady=5)
self.serverModuleButton= Button(self, text="I am the Server", command= self.unpackNetworkModeUI_LoadNetworkServerUI)
self.serverModuleButton.pack(side=TOP, padx=5, pady=5)
self.clientModuleButton= Button(self, text="I am a Client", command= self.unpackNetworkModeUI_LoadNetworkClientUI)
self.clientModuleButton.pack(side=TOP, padx=5, pady=5)
except Exception as inst:
print "============================================================================================="
print "GUI ERROR: An exception was thrown in networkModeUI definition Try block"
#the exception instance
print type(inst)
#srguments stored in .args
print inst.args
#_str_ allows args tto be printed directly
print inst
print "============================================================================================="
开发者ID:,项目名称:,代码行数:32,代码来源:
示例3: networkClientUI
def networkClientUI(self):
try:
self.parent.title("Mighty Cracker")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
#load buttons and labels
self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkClientUI_LoadInitUI)
self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
self.networkClientLabel= Label(self, text="Network Client")
self.networkClientLabel.pack(side=TOP, padx=5, pady=5)
self.insertServerIPLabel= Label(self, text="Enter in the Server's IP:")
self.insertServerIPLabel.pack(side=TOP, padx=5, pady=5)
self.insertServerIPTextfield= Entry(self, bd=5)
self.insertServerIPTextfield.pack(side=TOP, padx=5, pady=5)
#TODO allow right click for pasting into box
self.startClientButton= Button(self, text="Start Client", command=lambda: self.startClient(str(self.insertServerIPTextfield.get())))
self.startClientButton.pack(side=TOP, padx=5, pady=5)
except Exception as inst:
print "============================================================================================="
print "GUI ERROR: An exception was thrown in networkClientUI definition Try block"
#the exception instance
print type(inst)
#srguments stored in .args
print inst.args
#_str_ allows args tto be printed directly
print inst
print "============================================================================================="
开发者ID:,项目名称:,代码行数:32,代码来源:
示例4: initUI
def initUI(self):
self.parent.title("Windows")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
# Configures padding between items in application
self.columnconfigure(1, weight=1)
self.columnconfigure(3, pad=7)
self.rowconfigure(3, weight=1)
self.rowconfigure(5, pad=7)
self.lbl = Label(self, text="Windows")
self.lbl.grid(sticky=W, pady=4, padx=5)
self.area = Label(self)
# Column and row span make box go to that column/row
self.area.grid(row=1, column=0, columnspan=2, rowspan=4, padx=5, sticky=E+W+S+N)
self.abtn = Button(self, text="Connect", command = self.connect)
# self.abtn["command"] = update_box()
self.abtn.grid(row=1, column=3)
self.cbtn = Button(self, text="Close")
self.cbtn.grid(row=2, column=3, pady=4)
self.hbtn = Button(self, text="Help")
self.hbtn.grid(row=5, column=0, padx=5)
self.obtn = Button(self, text="Open")
self.obtn.grid(row=5, column=3)
开发者ID:Bobby-Schmidt,项目名称:OBD2-Scanner,代码行数:32,代码来源:position_tut.py
示例5: initUI
def initUI(self):
self.parent.title("Book downloader")
self.style = Style()
self.style.theme_use("default")
framesearch = Frame(self)
framesearch.pack(fill=BOTH)
search_label = Label(framesearch, text="Filter books:", padx=5, pady=5, width=15)
search_label.pack(side=LEFT)
self.search_entry = Entry(framesearch)
self.search_entry.pack(side=RIGHT, fill=X)
self.search_entry.bind("<Return>", self.searchHandler)
#self.search_entry.bind("<Key>", self.searchHandler)
framelist = Frame(self, relief=RAISED, borderwidth=1)
framelist.pack(fill=BOTH, expand=True)
self.lb = Listbox(framelist, height=30)
scrollbar = Scrollbar(framelist)
scrollbar.pack(side=RIGHT, fill=Y)
self.lb.config(yscrollcommand=scrollbar.set)
scrollbar.config(command=self.lb.yview)
self.loadLibrary()
for b in self.book_list:
self.lb.insert(END, b[0])
self.lb.pack(fill=BOTH)
self.pack(fill=BOTH, expand=True)
DownButton = Button(self, text="Download", command=self.downloadAction)
DownButton.pack(side=RIGHT)
开发者ID:joseche,项目名称:aws_scripts,代码行数:34,代码来源:download_books.py
示例6: initUI
def initUI(self):
self.parent.title("Batch Geocoder")
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)
menubar = Menu(self.parent)
self.parent.config(menu=menubar)
scrollbar = Scrollbar(self)
scrollbar.pack( side = RIGHT, fill=Y)
fileMenu = Menu(menubar)
fileMenu.add_command(label="Run", command=self.onOpen)
fileMenu.add_command(label="Exit", underline=0, command=self.onExit)
menubar.add_cascade(label="File", menu=fileMenu)
#menubar.add_command(label="Run", command=self.runScript)
self.txt = Text(self, yscrollcommand = scrollbar.set)
scrollbar.config( command = self.txt.yview )
self.txt.pack(fill=BOTH, expand=1)
开发者ID:Ccantey,项目名称:BatchGeoCode,代码行数:27,代码来源:BatchGeoCode.py
示例7: initUI
def initUI(self):
information = Label(self,text = " \n Information on "+business_list[int(business_index)]['name']+"\n \n Located at: \n " + business_list[int(business_index)]['full_address'] )
information.pack()
num_reviews = Label(self, text = "Number of Reviews : " + str(business_list[int(business_index)]['review_count']) )
num_reviews.pack()
type = Label(self, text = "Type of Restaurant : " + str(business_list[int(business_index)]['type']) )
type.pack()
cat = business_list[int(business_index)]['categories']
text_cat = ''
for item in cat:
text_cat = text_cat + ", " + item
categories = Label(self, text = "Category of the resaurtant "+ text_cat )
categories.pack()
w = Label(self, text=" \n Write a Review for "+business_list[int(business_index)]['name'] )
w.pack()
e = Text(self, height=20, width=100)
e.insert(END,"Insert Review Here")
e.pack()
b = Button(self, text="Submit Review",command=lambda: self.tostars(e.get(1.0, END)))
b.pack(side=BOTTOM, fill=BOTH)
self.pack(fill=BOTH, expand=1)
开发者ID:PatrickVo,项目名称:CSCE470-Project-Final,代码行数:28,代码来源:yelpPD.py
示例8: __init__
def __init__(self, name, add_handler, remove_handler, master=None):
"""
Creates a ListFrame with the given name as its title.
add_handler and remove_handler are functions to be called
when items are added or removed, and should relay the information
back to the Searcher (or whatever object actually uses the list).
"""
LabelFrame.__init__(self, master)
self['text'] = name
self.add_handler = add_handler
self.remove_handler = remove_handler
self.list = Listbox(self)
self.list.grid(row=0, columnspan=2)
# Tkinter does not automatically close the right-click menu for us,
# so we must close it when the user clicks away from the menu.
self.list.bind("<Button-1>", lambda event: self.context_menu.unpost())
self.list.bind("<Button-3>", self.open_menu)
self.context_menu = Menu(self, tearoff=0)
self.context_menu.add_command(label="Remove", command=self.remove)
self.input = Entry(self)
self.input.bind("<Return>", lambda event: self.add())
self.input.grid(row=1, columnspan=2)
self.add_button = Button(self)
self.add_button['text'] = "Add"
self.add_button['command'] = self.add
self.add_button.grid(row=2, column=0, sticky=W+E)
self.remove_button = Button(self)
self.remove_button['text'] = "Remove"
self.remove_button['command'] = self.remove
self.remove_button.grid(row=2, column=1, sticky=W+E)
开发者ID:sdsc,项目名称:sandbox-tweeteor,代码行数:31,代码来源:controller.py
示例9: initUI
def initUI(self):
try:
self.parent.title("Mighty Cracker")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
#load buttons and labels
self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
self.mainMenuLabel= Label(self, text="Main Menu")
self.mainMenuLabel.pack(side=TOP,padx=5, pady=5)
self.singleModeButton= Button(self, text="Single Computer Mode", command=self.unpackInitUI_LoadSingleComputerMode)
self.singleModeButton.pack(side=TOP, padx=5, pady=5)
self.networkModeButton= Button(self, text="Networking Mode", command=self.unpackInitUI_LoadNetworkMode)
self.networkModeButton.pack(side=TOP, padx=5, pady=5)
except Exception as inst:
print "============================================================================================="
print "GUI ERROR: An exception was thrown in initUI definition Try block"
#the exception instance
print type(inst)
#srguments stored in .args
print inst.args
#_str_ allows args tto be printed directly
print inst
print "============================================================================================="
开发者ID:,项目名称:,代码行数:28,代码来源:
示例10: init_ui
def init_ui(self):
self.parent.title("Activity Logger")
self.parent.focusmodel("active")
self.style = Style()
self.style.theme_use("aqua")
self.combo_text = StringVar()
cb = self.register(self.combo_complete)
self.combo = Combobox(self,
textvariable=self.combo_text,
validate="all",
validatecommand=(cb, '%P'))
self.combo['values'] = ["Food", "Email", "Web"]
self.combo.pack(side=TOP, padx=5, pady=5, fill=X, expand=0)
#self.entry = Text(self, bg="white", height="5")
#self.entry.pack(side=TOP, padx=5, pady=5, fill=BOTH, expand=1)
self.pack(fill=BOTH, expand=1)
self.centre()
self.ok = Button(self, text="Ok", command=self.do_ok)
self.ok.pack(side=RIGHT, padx=5, pady=5)
self.journal = Button(self, text="Journal", command=self.do_journal)
self.journal.pack(side=RIGHT, padx=5, pady=5)
self.exit = Button(self, text="Exit", command=self.do_exit)
self.exit.pack(side=RIGHT, padx=5, pady=5)
开发者ID:da4089,项目名称:alog,代码行数:31,代码来源:alog.py
示例11: TabServices
class TabServices(Frame):
def __init__(self, parent, txt=dict()):
"""Instanciating the output workbook."""
self.parent = parent
Frame.__init__(self)
# variables
self.url_srv = StringVar(self,
'http://suite.opengeo.org/geoserver/wfs?request=GetCapabilities')
# widgets
self.lb_url_srv = Label(self,
text='Web service URL GetCapabilities: ')
self.ent_url_srv = Entry(self,
width=75,
textvariable=self.url_srv)
self.btn_check_srv = Button(self, text="youhou")
# widgets placement
self.lb_url_srv.grid(row=0, column=0,
sticky="NSWE", padx=2, pady=2)
self.ent_url_srv.grid(row=0, column=1,
sticky="NSWE", padx=2, pady=2)
self.btn_check_srv.grid(row=0, column=2,
sticky="NSWE", padx=2, pady=2)
开发者ID:Guts,项目名称:DicoGIS,代码行数:25,代码来源:tab_geoservices.py
示例12: initUI
def initUI(self):
self.parent.title("FirstGUI")
self.pack(fill=BOTH, expand=1)
quitButton = Button(self, text="Quit", command=self.quit)
quitButton.place(x=100, y=100)
开发者ID:mdriller,项目名称:eclipse_workspace,代码行数:7,代码来源:tkinter_test.py
示例13: showLoading
def showLoading(self):
self.attemptedMarkov = True
popup = Toplevel()
text = Message(popup, text="The Markov Generator is still loading!\n\nText will show up when loaded!")
text.pack()
closePop = Button(popup, text="Okay!", command=popup.destroy)
closePop.pack()
开发者ID:jahardin,项目名称:175Project,代码行数:7,代码来源:interface.py
示例14: __init__
class MyButton:
#Класс для улучшения читаемости кода однотипных элементов кнопок.
def __init__(self, place_class, string_class, command_class):
#При создании принимается место прикрепления виджета, строковое значение для надписи
#и строковое для установления команды при нажатии.
self.button_class = Button(place_class, width = 30, text = string_class, command = command_class)
self.button_class.pack(side = LEFT)
开发者ID:,项目名称:,代码行数:7,代码来源:
示例15: 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
示例16: initUI
def initUI(self):
self.parent.title("File dialog")
menubar = Menu(self.parent)
self.parent.config(menu=menubar)
fileMenu = Menu(menubar)
fileMenu.add_command(label="Open", command=self.onOpen)
menubar.add_cascade(label="File", menu=fileMenu)
self.style = Style()
self.style.theme_use("default")
global frame1
frame1 = Frame()
frame1.grid(row=0, column=0, sticky='w')
l1 = Label(frame1, text='CSV file name', relief=RIDGE, width=20)
l1.grid(row=4, column=0)
l2 = Label(frame1, text='SCR file name', relief=RIDGE, width=20)
l2.grid(row=5, column=0)
inform = Button(frame1, text="Choose CSV file", command=self.onCSVfile)
inform.grid(row=1, column=0)
self.file_opt = options = {}
options['defaultextension'] = '.csv'
options['filetypes'] = [('CSV files', '.csv'), ('all files', '.*')]
开发者ID:martst,项目名称:cadscript,代码行数:29,代码来源:cadscript.py
示例17: _setup_button_toolbar
def _setup_button_toolbar(self):
'''
The button toolbar runs as a horizontal area at the top of the GUI.
It is a persistent GUI component
'''
# Main toolbar
self.toolbar = Frame(self.root)
self.toolbar.grid(column=0, row=0, sticky=(W, E))
# Buttons on the toolbar
self.run_button = Button(self.toolbar, text='Run', command=self.cmd_run)
self.run_button.grid(column=0, row=0)
self.step_button = Button(self.toolbar, text='Step', command=self.cmd_step)
self.step_button.grid(column=1, row=0)
self.next_button = Button(self.toolbar, text='Next', command=self.cmd_next)
self.next_button.grid(column=2, row=0)
self.return_button = Button(self.toolbar, text='Return', command=self.cmd_return)
self.return_button.grid(column=3, row=0)
self.toolbar.columnconfigure(0, weight=0)
self.toolbar.rowconfigure(0, weight=0)
开发者ID:adamchainz,项目名称:bugjar,代码行数:25,代码来源:view.py
示例18: __init__
def __init__(self, parent, controller):
Frame.__init__(self, parent)
self.controller = controller
label = Label(self, text="About", font=TITLE_FONT, justify=CENTER, anchor=CENTER)
label.pack(side="top", fill="x", pady=10)
label_2 = Label(self, text=
""" Frogs vs Flies is a cool on-line multi-player game.
It consists of hungry frogs, trying to catch some darn
tasty flies to eat and not starve to death, and terrified,
but playful flies that try to live as long as possible
to score points by not being eaten by nasty frogs.
----------------------------------------------------------------------------------------
When the game has been selected or created, and your
class selected, click in the game field to start feeling your
limbs. To move, use your keyboard's arrows.
By this point, you should know where they are located,
don't you? Great! Now you can start playing the game!
----------------------------------------------------------------------------------------
Frogs, being cocky little things, have the ability to
do a double jump, holding SHIFT while moving with cursors.
And flies, being so fly, that the air can't catch up with
them, have a greater field of view, so they can see frogs
before they can see them.
----------------------------------------------------------------------------------------
Have a wonderful time playing this awesome game!
----------------------------------------------------------------------------------------
Created by Kristaps Dreija and Egils Avots in 2015 Fall
""", font=ABOUT_FONT, anchor=CENTER, justify=CENTER)
label_2.pack()
button1 = Button(self, text="\nBack\n", command=lambda: controller.show_frame("StartPage"))
button1.pack(ipadx=20,pady=10)
开发者ID:kristapsdreija,项目名称:Frogs-vs-Flies,代码行数:32,代码来源:tkinter_main.py
示例19: initUi
def initUi( self ):
self.parent.title( "Supply handler" )
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 )
self.openBtn = Button( self, text="Compile script", command=self.openFirmwareSource )
self.openBtn.grid( row=0, column=0, rowspan=1, columnspan=1, sticky=W+N )
self.flashBtn = Button( self, text="Load script", command=self.flashFirmware )
self.flashBtn.grid( row=0, column=1, rowspan=1, columnspan=1, sticky=W+N )
self.dfuBtn = Button( self, text="Firmware upgrade", command=self.dfuFirmware )
self.dfuBtn.grid( row=0, column=2, rowspan=1, columnspan=1, sticky=W+N )
self.helpBtn = Button( self, text="Help", command=self.openHelp )
self.helpBtn.grid( row=0, column=3, rowspan=1, columnspan=1, sticky=W+N )
self.txt = Text( self )
self.txt.grid( row=2, column=0, rowspan=5, columnspan=4, sticky=E+W+S+N )
开发者ID:yalovenko,项目名称:supply,代码行数:25,代码来源:supply.py
示例20: initializeComponents
def initializeComponents(self):
self.boxValue = StringVar()
self.boxValue.trace('w', \
lambda name, index, mode, \
boxValue = self.boxValue : \
self.box_valueEditted(boxValue))
self.box = Combobox(self,\
justify = 'left',\
width = 50, \
textvariable = self.boxValue,\
)
self.box.pack(side = 'left',expand = 1, padx = 5, pady = 5)
self.box.bind('<<ComboboxSelected>>',self.box_selected)
self.box.bind('<Return>',self.box_returned)
self.importButton = Button(self, \
text = "Import", \
command = self.importButton_clicked,\
)
self.importButton.pack(side = 'left',expand = 1)
self.cmd_str = StringVar(None,"Prefix Only")
self.switchButton = Button(self, \
textvariable = self.cmd_str, \
command = self.switchButton_clicked, \
)
self.switchButton.pack(side = 'right', padx = 5, pady = 5)
开发者ID:jz33,项目名称:Autocomplete-Trie-Python,代码行数:28,代码来源:View.py
注:本文中的ttk.Button类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论