Completed
Pull Request — master (#22)
by Jerome
01:25
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
    import ttk
7
    import tkFileDialog as filedialog
8
9
elif version_info[0] == 3:
10
    # We are using Python 3.x
11
    import tkinter as tk
12
    from tkinter import ttk
13
    import tkinter.filedialog as filedialog
14
15
class CustomFrame(tk.Frame):
16
    def __init__(self,*args,**kwargs):
17
        super(CustomFrame,self).__init__(*args,**kwargs)
18
        self.bind("<Configure>", self.configure)
19
        self.drawn = []
20
        self.height = 0
21
        self.width = 0
22
        if "height" in kwargs:
23
            self.height = kwargs["height"]
24
        if "width" in kwargs:
25
            self.width = kwargs["width"]
26
27
    def configure(self, event):
28
        self.height = event.height
29
        self.width = event.width
30
        self.informHeight()
31
32
    def informHeight(self):
33
        pass
34
35
    def grid(self,*args,**kwargs):
36
        pass
37
38
class CustomLabel(tk.Frame):
39
    pass
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