Completed
Pull Request — master (#22)
by Jerome
25s
created

CustomLabel   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 2
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 2
rs 10
c 1
b 0
f 0
wmc 0
1
from sys import version_info
2
3
if version_info[0] == 2:
4
    # We are using Python 2.x
5
    import Tkinter as tk
6
7
elif version_info[0] == 3:
8
    # We are using Python 3.x
9
    import tkinter as tk
10
11
12
class CustomFrame(tk.Frame):
13
    def __init__(self, *args, **kwargs):
14
        super(CustomFrame, self).__init__(*args, **kwargs)
15
        self.bind("<Configure>", self.configure)
16
        self.drawn = []
17
        self.height = 0
18
        self.width = 0
19
        if "height" in kwargs:
20
            self.height = kwargs["height"]
21
        if "width" in kwargs:
22
            self.width = kwargs["width"]
23
24
    def configure(self, event):
25
        self.height = event.height
26
        self.width = event.width
27
        self.informHeight()
28
29
    def informHeight(self):
30
        pass
31
32
    def grid(self, *args, **kwargs):
33
        pass
34
35
36
class CustomLabel(tk.Frame):
37
    pass
38
39
40
if __name__ == '__main__':
41
    master = tk.Tk()
42
    i = CustomFrame(width=320, height=280)
43
    l1 = tk.Label(i, text="Blablabla")
44
    l1.grid()
45
    i.pack(fill=tk.BOTH, expand=1)
46
    tk.mainloop()
47