tkinter rowpan无效

时间:2019-03-22 18:58:09

标签: python python-2.7 tkinter

我有以下代码:

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根本没有任何作用,什么地方出错了?

1 个答案:

答案 0 :(得分:0)

您的窗口小部件只有一行,因此跨越两行将看起来就像跨越一行。空行的高度为零。