-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.py
More file actions
29 lines (23 loc) · 718 Bytes
/
test2.py
File metadata and controls
29 lines (23 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Tkinter as tk
class MatrixLabel(tk.Frame):
"""
the labels of the statistics matrix
"""
def __init__(self,master, value="", **kwargs):
tk.Frame.__init__(self, master, background="blue",
**kwargs)
self.text = tk.StringVar()
self.label = tk.Label(self, textvariable = self.text, bg="pink", anchor = tk.CENTER)
self.text.set(value)
self.label.grid(sticky="nsew")
def set(self, x):
self.text.set(x)
root = tk.Tk()
ml = MatrixLabel(root)
ml.set("bla")
ml.grid(sticky="nsew")
ml.columnconfigure(0,weight=1)
ml.rowconfigure(0,weight=1)
root.columnconfigure(0,weight=1)
root.rowconfigure(0,weight=1)
root.mainloop()