使Tkinter窗口在父窗口或屏幕上居中的功能

center-tk-window的Python项目详细描述


中央油箱窗口

在父窗口或屏幕上使Tkinter窗口居中的小库。

安装

要安装,请运行以下命令: pip install center_tk_window

用法

importtkinterimportcenter_tk_windowroot_window=tkinter.Tk()window_to_center=tkinter.Toplevel(root_window)# Center a window on its parent unless it is the root window in which case it will be centered on screen.center_tk_window.center(root_window,window_to_center)# Center a window on its parentcenter_tk_window.center_on_parent(root_window,window_to_center)# Center a window on the screencenter_tk_window.center_on_screen(window_to_center)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
maven字段#getGenericType()抛出java。lang.TypeNotPresentException   用java绘制三角形的几何图形   java无法下载主题和发件人地址(rediff)   java如何使代码线程安全   java在尝试转换FileInputStream中的文件时,我遇到了一个FileNotFound异常   java Moxy和Jackson如何将Json映射到Pojo   在foreach循环中使用BufferedWriter生成新行的java问题   java为什么我的测试在单次执行中运行时间小于1秒,而在maven构建中运行时间大于20秒?   java如何显示下载附件的进度条   了解java rmi的良好实践   .net可以将Java portlet嵌入ASP。网页?   循环如何多次执行Java方法?   java如何确保用户输入在给定的有效范围内?   java单元测试定理   java如何在IntelliJ上运行外部构建项目?   JAVA:试图编写一个检查字符串是否为数字的方法。总是返回错误   javahadoop将特定键的所有map方法生成的所有值都发送到一个reduce方法,对吗?   在java中读取和使用文件