parent.columnconfigure(0, weight=1)
button.grid(sticky='ew')
Run Code Online (Sandbox Code Playgroud)
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
root.geometry('600x400+0+0')
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
tabs = ttk.Notebook()
tabs.grid(row=0, column=0, sticky='nsew')
tab1 = tk.Frame(tabs, bg='red')
tab2 = tk.Frame(tabs, bg='green')
tabs.add(tab1, text='First Tab')
tabs.add(tab2, text='Second Tab')
root.mainloop()
Run Code Online (Sandbox Code Playgroud) 我的问题是我想获取在 ttk.DateEntry 小部件中选择的日期的值。根据此文档,您需要使用 get_date()文档
可能是我误解了它的用法,但我收到以下错误
AttributeError:“DateEntry”对象没有属性“get_date”
我确实使用这个库来设计ttkboostrap
这是我的代码示例:
import tkinter as tk
import tkinter
import ttkbootstrap as ttk
##setup the window
pwin = ttk.Window(themename="cyborg")
pwin.title('test')
##function to get the date
def seedate():
print(cal.get_date())
##this is he DateEntry widget
cal = ttk.DateEntry(pwin,bootstyle="info")
cal.place(x=10, y=80)
#button to get the selected date
btnpt = ttk.Button(pwin, text="Save Schedule", bootstyle="light-outline", command=seedate)
btnpt.place(x=10, y=140)
pwin.mainloop()
Run Code Online (Sandbox Code Playgroud)