python - tkinter rowspan 没有效果
问题描述
我有以下代码:
import Tkinter as tk
import os
from PIL import Image, ImageTk
import Tkinter, Tkconstants, tkFileDialog
class Home(tk.Tk):
def __init__(self, *args,**kwargs):
tk.Tk.__init__(self, *args, **kwargs)
self.geometry('1200x800')
self.txt = tk.StringVar()
self.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
self.home_frame = tk.Frame(self)
self.home_frame.grid(row=0, column=0)
self.home_frame.rowconfigure(0, weight=1)
self.home_frame.columnconfigure(0, weight=1)
self.fileEntry = tk.Entry(self.home_frame, width=100, textvariable=self.txt).grid(row=0, column=0, sticky='sn')
self.btn = tk.Button(self.home_frame, text='choose directory', height=1, command=self.DirDialog).grid(row=0, column=1)
现在对于 fileEntry 添加 rowspan=2 完全没有效果有什么问题?
解决方案
您的小部件只有一行,因此跨越两行看起来就像跨越单行一样。空行的高度为零。
推荐阅读
- javascript - 如果未选中任何按钮,如何使单选按钮选项成为必需并弹出错误横幅?
- angular - 与firebase一起使用时异步不起作用
- reactjs - React Native Reanimated 函数渲染如何只拍摄一次
- python - 如何使用 pydriller 从特定分支获取提交?
- pandas - 如何将不可变 MultiDict 转换为数据框
- python - 如何在 Windows 上运行 python 项目
- math - 生成总和为给定数字并遵守一组一般约束的随机自然数
- c# - 即使类不拥有这些依赖项,但在方法中使用它们,您是否在构造函数中注入依赖项?
- javascript - 如何在 React 中动态设置 CSS 属性(背景颜色)?
- c# - 找不到属性的 setvalue 方法