我想把一个按钮和一个复选按钮放在同一行的中间。 如果我把(side=LEFT)放在同一行,但是它们在左边(当然!)。我该怎么做?你知道吗
from tkinter import*
from tkinter import messagebox
root = Tk()
root.configure(bg='lightblue')
root.title("#1")
root.geometry("180x60+350+220")
request = StringVar() #i did the same with all other variables
inte=["explorer" , "Explorer","rete"]
chro=["chrome" ,"Chrome","ricerca",]
of=["openoffice","foglio bianco","scrittura"]
dia = Entry(root, textvariable = request, bg="white").grid(row=0,column=1)
class App:
def __init__(self, root):
self.root = root
self.check = Checkbutton(self.root, bg="lightblue", onvalue=1, offvalue=0)
self.check.pack(side=BOTTOM)
self.check.bind("<Enter>", self.enter)
self.check.bind("<Leave>", self.leave)
def enter(self, *args):
self.top = Toplevel(self.root)
self.top.wm_overrideredirect(1)
self.top.geometry("+%d+%d" % (self.root.winfo_rootx()+self.check.winfo_x()+self.check.winfo_width(), self.root.winfo_rooty()+self.check.winfo_y()))
self.label = Label(self.top, text="Attiva ricerca con google", bg="white")
self.label.pack()
def leave(self, *args):
self.top.destroy()
App(root)
chk = Checkbutton(root,text="Ricerca in internet", textvariable = fla,
bg="lightblue").grid(row=0,column=0) #first checkbutton
chk1 = Checkbutton(root,text="Ricerca in internet", textvariable = ran,
bg="lightblue").grid(row=0,column=2) #the second one
def apri():
if request.get().strip() in inte:
subprocess.Popen(['C:\Program Files\Internet Explorer\\iexplore.exe'])
#i did the same with all other lists
else:
webbrowser.open("https://www.google.it/search?q={0}&oq={0}&aqs=chrome..69i57j0j69i61j0l3.1306j0j7&sourceid=chrome&ie=UTF-8".format(request.get().strip()))
bott = Button(root, text="Cerca", command = apri,bg="white").grid(row=1,column=1)
现在checkbutton没有功能,但首先我想设置接口。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐