【发布时间】:2019-06-16 16:02:59
【问题描述】:
我在 Tkinter 中创建了一个文本字段,在文本字段旁边添加了新项目,但我无法通过网格获得底线。添加网格时,窗口不会打开。解决办法是什么?
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import tkinter as tk
pencere = tk.Tk()
frame = tk.Frame(pencere)
frame.pack()
scrol = tk.Scrollbar(frame)
scrol.pack(side=tk.RIGHT, fill=tk.Y)
text = "Good bye"
text = tk.Text(frame,width=70, height=0)
text.insert(tk.INSERT, text)
text.config(yscrollcommand=scrol.set)
scrol.config(command=text.yview)
text.pack(side=tk.LEFT, fill=tk.Y)
buton = tk.Button(frame, text='close', command=pencere.destroy)
buton.pack()
text.grid(row=1, column=1)
pencere.mainloop()
【问题讨论】:
标签: python python-3.x tkinter