本文整理汇总了Python中tkinter.ttk.Button.place方法的典型用法代码示例。如果您正苦于以下问题:Python Button.place方法的具体用法?Python Button.place怎么用?Python Button.place使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Button
的用法示例。
在下文中一共展示了Button.place方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_gui
# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import place [as 别名]
def setup_gui(self):
self.parent.title("Stein - Saks - Papir")
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
# Label for rapportering
label = Label(self.parent, textvariable=self.resultat_label)
label.place(x=800, y=50)
# Buttons
# Disse fyrer av metoden self.arranger_enkeltspill som er
# definert i klassen. Denne metoden tar aksjonen til mennesket
# som startup, og gjennomfoerer spillet
# Samme type oppfoersel for de tre aksjons-knappene
rock_button = Button(self, text="Stein",
command=lambda: self.arranger_enkeltspill(Action("rock")))
rock_button.place(x=800, y=400)
scissors_button = Button(self, text="Saks",
command=lambda: self.arranger_enkeltspill(Action("scissor")))
scissors_button.place(x=900, y=400)
paper_button = Button(self, text="Papir",
command=lambda: self.arranger_enkeltspill(Action("paper")))
paper_button.place(x=1000, y=400)
# quit_button avslutter GUI'et naar den trykkes
quit_button = Button(self, text="Quit", command=self.quit)
quit_button.place(x=1000, y=450)
# Embedde en graf i vinduet for aa rapportere fortloepende score
self.fig = FigureCanvasTkAgg(pylab.figure(), master=self)
self.fig.get_tk_widget().grid(column=0, row=0)
self.fig.show()
示例2: initUI
# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import place [as 别名]
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=200, y=50)
buttons_list = []
g=0
c=0
for i in range(1,52):
crnt_button = Label(self, text=str(i),background=FF0000)
crnt_button.grid(row=g, column=c)
buttons_list.append(crnt_button)
c += 1
if i%10 ==0:
g +=1
c=0
示例3: initUI
# 需要导入模块: from tkinter.ttk import Button [as 别名]
# 或者: from tkinter.ttk.Button import place [as 别名]
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)