我正在尝试创建一个自己的框架,为此我想在苹果电脑上使用tkinter
制作一个GUI。在
在Mac OS X上,notebook.tabs
的text
(标题)似乎没有正确显示,如下所示:
如您所见,text
不是水平居中的,而是稍微移到顶部。在
我的代码如下:
#!/usr/bin/env python3
# coding: utf-8
import tkinter as tk
from tkinter import ttk
class SpiderGUI():
def __init__(self, master):
self.master = master
self.frame = ttk.Frame(self.master, padding=(10, 10, 10, 10))
self.frame.pack(fill="both", expand="True")
self.paned_window = ttk.Panedwindow(self.frame, orient="horizontal")
self.paned_window.pack(fill="both", expand="True")
self.frame_settings = ttk.Frame(self.paned_window, width=75, height=300, relief="sunken")
self.paned_window.add(self.frame_settings)
self.frame_output = ttk.Frame(self.paned_window, width=950, height=300, relief="sunken")
self.paned_window.add(self.frame_output, weight="4")
self.frame_logging = ttk.Frame(self.paned_window, width=175, height=500, relief="sunken")
self.paned_window.add(self.frame_logging)
self.console_notebook = ttk.Notebook(self.frame_output)
self.console_notebook.pack()
self.frame_tab_console = ttk.Frame(self.console_notebook)
self.console_notebook.add(self.frame_tab_console, text="Console", padding=(10))
self.frame_tab_database = ttk.Frame(self.console_notebook)
self.console_notebook.add(self.frame_tab_database, text="MongoDB")
def main():
root = tk.Tk()
app = SpiderGUI(root)
# root.geometry(newGeometry="1200x800+100+100")
root.title('name')
root.resizable(width=True, height=False)
# root.maxsize(width=1280, height=1024)
# root.minsize(width=640, height=480)
root.mainloop()
if __name__ == '__main__':
main()
最好将mrushabh回答的修复应用于OSX,如下所示:
如果有人还需要解决这个问题。这很老套,但很管用:
相关问题 更多 >
编程相关推荐