python - 无论屏幕大小如何,如何将小部件放在窗口的某个位置。特金特
问题描述
我将 tkinter 窗口设置为全屏,但是当我使用 place 时,它不会将小部件放在屏幕上。在较小屏幕上的中心不是我屏幕的中心。
有谁知道有什么办法让它保持为中心。
Python3顺便说一句。
def Quit():
os._exit(1)
window1=tkinter.Tk()
window1.title("QUEST")
#window1.geometry("500x500")
window1.configure(bg="black")
window1.attributes("-fullscreen", True)
menubar = tkinter.Menu(window1)
filemenu = tkinter.Menu(menubar, tearoff=0)
menubar.add_cascade(label="Quit", command=Quit)
window1.config(menu=menubar)
Label=tkinter.Label(window1, text="WELCOME TO", bg="black", fg="white", font=("century gothic",50))
Label.place(x=725, y=60)
Label2=tkinter.Label(window1, text="QUEST", bg="black", fg="white", font=("century gothic",50))
Label2.place(x=850, y=160)
bt=tkinter.Button(window1, bg="lightgray", fg="black", text="START", font=("century gothic",30), command=Start)
bt.place(x=250, y=600)
bt2=tkinter.Button(window1, bg="lightgray", fg="black", text="QUIT", font=("century gothic",30), command=Quit)
bt2.place(x=1500, y=600)
window1.mainloop()
解决方案
推荐阅读
- ios - 如何在 iOS 中以终止/终止模式调用 API
- asp.net-mvc - 我不断收到错误消息:“对象引用未设置为对象的实例。”
- xamarin.android - 在 Xamarin.UiTest 中访问视图的自定义属性
- javascript - 如何修复来自 Jquery Ajax 发布请求的“net::ERR_EMPTY_RESPONSE”错误?
- python - 为什么我在以下代码的输出末尾没有得到任何内容以及如何避免它?
- xaml - 如何在 CollectionView 中存储值
- apache-camel - 多播的 StopOnException 不起作用
- android - 下载的项目不会在实际手机中运行
- r - 如何按组计算平均空间位置
- javascript - 按对象内的值对数组对象进行角度排序