ttk: how to make a frame look like a labelframe?

限于喜欢 提交于 2019-12-04 11:36:44

OK, seems like one solution to getting the LabelFrame without the gap is to use an empty widget in place of the text. So, modifying the first part of your example slightly:

# don't do the 'from tkinter import *' thing to avoid namespace clashes
import tkinter   # assuming Python 3 for simplicity's sake
import tkinter.ttk as ttk 

root = tkinter.Tk()

f = tkinter.Frame(relief='flat')
lF = ttk.LabelFrame(root, labelwidget=f, borderwidth=4)
lF.grid()
b = ttk.Button(lF, text='gonzo')
b.grid()

root.mainloop()

Seems to work for me with the regular Win7 theme.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!