Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么Tkinter不是';I don’我的窗户是垂直的_Python_User Interface_Tkinter_Window - Fatal编程技术网

Python 为什么Tkinter不是';I don’我的窗户是垂直的

Python 为什么Tkinter不是';I don’我的窗户是垂直的,python,user-interface,tkinter,window,Python,User Interface,Tkinter,Window,因此,我正在使用Tkinter制作我的第一个GUI应用程序,我的问题是,每当我要求我的窗口填充我的屏幕时,或多或少有四分之一的窗口没有任何小部件(),我不知道这是从哪里来的 以下是所有相关代码: GUI.py(主GUI代码) 编写_env.py(右侧小部件的代码): 编辑:Atlas453的评论解决了这个问题,谢谢尝试删除root.grid\u rowconfigure(1,weight=1),并将root.update()替换为root.update\u idletasks()这一行self.

因此,我正在使用Tkinter制作我的第一个GUI应用程序,我的问题是,每当我要求我的窗口填充我的屏幕时,或多或少有四分之一的窗口没有任何小部件(),我不知道这是从哪里来的

以下是所有相关代码:
GUI.py(主GUI代码)

编写_env.py(右侧小部件的代码):


编辑:Atlas453的评论解决了这个问题,谢谢

尝试删除
root.grid\u rowconfigure(1,weight=1)
,并将
root.update()
替换为
root.update\u idletasks()
这一行
self.grid(row=0,column=1,sticky='nsew')
也应该删除,在主模块中对其进行网格化时。在根的网格中创建两行,但只使用第0行。
from tkinter import *

from write_env import *

BGC = '#1e1e1e'
FGC = '#ced4d4'

root = Tk()
root.title("Gamebook Maker")

# Grid setup
root.grid()
root.grid_columnconfigure(0,weight=1)
root.grid_columnconfigure(1,weight=1)
root.grid_rowconfigure(0,weight=1)
root.grid_rowconfigure(1,weight=1)
root.update()

# Frames placement
write = write_environement(root, bgc = BGC, fgc = FGC)
write.grid(row=0, column=1, sticky='nsew')

paragraph_list = Listbox(root, width= 20, height= 35, bg = "#333333", fg = FGC)
paragraph_list.grid(row=0, column=0, sticky='nsew')
paragraph_list.insert(1, "test")


root.mainloop()    
from tkinter import *

class write_environement(Frame):
    """ class for the writing/plotting module v0.1"""

    def __init__(self, parent, bgc, fgc):
        Frame.__init__(self, parent, bg="#36393f")

        self.grid(row=0, column=1, sticky='nsew')
        self.grid_columnconfigure(0, weight= 1)
        self.grid_rowconfigure(0, weight=1)
        self.grid_rowconfigure(1, weight=1)

        self.write_tab = Text(self, bg=bgc, fg=fgc, width= 80, height= 20, font=12)
        self.write_tab.config(wrap=WORD)
        self.write_tab.grid(row=0, column=0, sticky='nsew',padx=5, pady=5)

        self.followup_list = Listbox(self, width= 120, height= 10, bg = "#333333", fg = fgc)
        self.followup_list.grid(row=1, column=0, sticky='nsew',padx=5, pady=5)
        self.followup_list.insert(1, "test")