到目前为止,这是我的代码:
playerScore
我想要3帧:
我接下来尝试的所有东西似乎都毁了我迄今为止的格式。
答案 0 :(得分:0)
如果您希望左侧框架填充多行,请使用rowspan
。以下是如何操作,我在每个框架中添加Canvas
背景颜色,以便您可以看到它们的位置。这里最重要的是我使用rowspan = 2
左边的框架来跨越2行。您应该删除画布并将小部件放在适当的框架中。
from tkinter import *
from tkinter import ttk
#create root window
root = Tk()
root.geometry('640x480+25+75')
root.title('Dragon Slayer')
#create Main frame
frame = ttk.Frame(root)
frame.grid(sticky= N+W+E+S)
frame.config(height = 480, width = 640)
frame.config(relief = SUNKEN)
#create Left Controls frame
frame_controls = ttk.Frame(frame)
frame_controls.grid(row = 0, column = 0, rowspan = 2, sticky="nesw")
frame_controls.config(height = 480, width = 125)
frame_controls.config(relief = SUNKEN)
can_l = Canvas(frame_controls, height = 480, width = 215, bg="green")
can_l.grid()
#Location Information Frames (top right)
frame_loc = ttk.Frame(frame)
frame_loc.grid(row = 0, column = 1, sticky="nesw")
frame_loc.config(height = 180, width = 515)
frame_loc.config(relief = SUNKEN)
can_tr = Canvas(frame_loc, height = 180, width = 515, bg="red")
can_tr.grid()
#Create Game Frames (bottom right)
frame_game = ttk.Frame(frame)
frame_game.grid(row = 1, column = 1, sticky="nesw")
frame_game.config(height = 480, width = 640)
frame_game.config(relief = SUNKEN)
can_br = Canvas(frame_game, height = 300, width = 515, bg="blue")
can_br.grid()
如果您希望在调整窗口大小时展开框架,请使用grid_rowconfigure
和grid_columnconfigure
进行查看。
这些帖子可能有所帮助:
答案 1 :(得分:0)
自从我问这个问题后,我做了足够多的研究来自己回答,至少目前是一个相当不错的答案。我将以最终格式发布我使用的代码。
A B C Group
1 5.3 1 2
2 9.2 2 2
3 5 3 2
5 8 4 3
8 10 5 1
9 9.5 6 1
10 4 7 4