我这辈子都无法扩展这个 ttk / tkinter 分隔符

I can't for the life of me get this ttk / tkinter separator to expand

我必须为我正在做的一些课程编写程序,我选择做一个 A-Level 复习游戏来帮助别人。我正在尝试使用 ttk 分隔符将游戏部分出现的 window 区域与问题所在的 window 区域分开。我的 window 被分成 3 帧;一个有 4 个标签,一个有 4 个按钮,一个有 ttk.Separator 小部件和标签。但是我无法让分隔符跨越整个 window.

我一直在环顾四周并进行测试,但似乎没有任何效果。我在这个网站上看过这两个以前的帖子:


A Label in a Frame in a window won't stretch, why?

但是这些解决方案似乎都没有解决我的问题,我现在完全没有想法了。任何帮助将不胜感激。

main_revision_game_question_frame = Frame(parent_window, bg='#c2f0f0')
main_revision_game_question_frame.pack()
main_revision_game_question_frame.grid_propagate(1)
main_revision_game_question_frame.config(width=screen_width, height=40)

separator = ttk.Separator(main_revision_game_question_frame, orient=HORIZONTAL)
separator.grid(column=0, row=0, sticky='ew')

question_label = Label(main_revision_game_question_frame,
                               text='     Placeholder text for a question goes here!    
                             \n######################################################',
                               bg='#c2f0f0', fg='#ff2824', font='"Open Sans" 26 bold')
question_label.grid(column=0, row=1, sticky='ew')

main_revision_game_question_frame.grid_columnconfigure(0,weight=1)
main_revision_game_question_frame.grid_rowconfigure(0, weight=1)

这是我尝试组合几个解决方案后得到的代码,它看起来是这样的:

您可以看到分隔符在那里,但它没有跨越框架。感谢阅读。

尝试使用

main_revision_game_question_frame.pack(fill="both")

所以框架填满了整个space它是给定的

分隔符正在扩展以填充框架,但框架尚未配置为填充给定的space。

您需要扩展框架。一种方法是使用 pack:

fill 选项
main_revision_game_question_frame.pack(fill="x")