我的目标是在tkinter中创建3个大小相等的列,然后用我想要的内容填充它们。 我想做的事情与Bootstrap中的网格系统类似,但是在tkinter中,在列中添加某些内容会使列变大。
然后我的问题是,如何创建固定大小的列?
谢谢!
创建不相等列的代码:
class MainPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent, background = "black")
self.columnconfigure(0, weight = 1)
self.columnconfigure(1, weight = 1)
self.columnconfigure(2, weight = 1)
self.rowconfigure(0, weight = 1)
self.rowconfigure(1, weight = 1)
label = tk.Label(self, text = "Weather", fg = "white", bg="green", font = LARGE_FONT)
label.grid(row = 0, column = 0, padx = 0, pady = 0, sticky = 'new')
label = tk.Label(self, text = "Time", fg = "white", bg="blue", font = LARGE_FONT)
label.grid(row = 0, column = 1, pady = 0, sticky = 'nwe')
label = tk.Label(self, text = "Test", fg = "white", bg="red", font = LARGE_FONT)
label.grid(row = 0, column = 2, pady = 0, sticky = 'nwe')
label2 = tk.Label(self, text = "News", fg = "white", bg="black", font = LARGE_FONT)
label2.grid(row = 1, column = 0, padx = 0, pady = 10, sticky = 'sw')
答案 0 :(得分:2)
import * as React from "react";
import { View, Button } from "react-native";
import launchMailApp from "react-native-mail-launcher";
export default class Example extends React.Component {
render() {
return (
<View>
<Button onPress={launchMailApp}>Go to mail client</Button>
</View>
);
}
}
有一个专门用于大小相等的列和行的选项:grid
。它采用任何字符串作为值,并且具有相同值的所有列将具有相同的大小。
在您的情况下,它看起来像这样:
uniform