Completed
Push — master ( 87fb07...159278 )
by Jerome
01:13
created

TrueFalseWidget   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A draw() 0 5 1
A __init__() 0 4 1
1
from sys import version_info
2
if version_info[0] == 2:
3
    # We are using Python 2.x
4
    import Tkinter as tk
5
elif version_info[0] == 3:
6
    # We are using Python 3.x
7
    import tkinter as tk
8
9
10
class MyWidget:
11
    def __init__(self, label):
12
        self.label = label
13
14
15
class TrueFalseWidget(MyWidget):
16
    def __init__(self, label):
17
        super(TrueFalseWidget, self).__init__(label)
18
        self.widget = None
19
        self.labelw = None
20
21
    def draw(self, root, line):
22
        self.widget = tk.Checkbutton(root)
23
        self.widget.grid(column=1, row=line, sticky=tk.NSEW)
24
        self.labelw = tk.Label(root, text=self.label, justify=tk.LEFT)
25
        self.labelw.grid(column=2, row=line, sticky=tk.NSEW)
26
27
class ScaleWidget(tk.Frame):
28
    def __init__(self,master,label,min_,max_,redundancy=0):
29
        super(ScaleWidget,self).__init__(master)
30
        self.min = min_
31
        self.max = max_
32
        self.variables = [tk.Entry(master,width=2) for i in range(redundancy+1)]
33
        self.label = tk.Label(master, text=label)
34
35
36