Esempio n. 1
0
class Triangle(object):
    x1, x2, x3, y1, y2, y3 = 0, 0, 0, 0, 0, 0
    fill_color = ''

    def __init__(self):
        self.w = Screen().w

    def set_triangle_dimensions(self, x1, y1, x2, y2, x3, y3):
        Triangle.x1 = x1
        Triangle.y1 = y1
        Triangle.x2 = x2
        Triangle.y2 = y2
        Triangle.x3 = x3
        Triangle.y3 = y3

    def draw(self):
        points = [
            Triangle.x1, Triangle.y1, Triangle.x2, Triangle.y2, Triangle.x3,
            Triangle.y3
        ]
        self.w.create_polygon(points,
                              outline='#000000',
                              fill=Triangle.fill_color)

    def set_fill_color(self, fill_color):
        Triangle.fill_color = fill_color
Esempio n. 2
0
class Line(object):
    x1, x2, y1, y2 = 0, 0, 0, 0

    def __init__(self):
        self.w = Screen().w

    def set_line_dimension(self, x1, y1, x2, y2):
        Line.x1 = x1
        Line.y1 = y1
        Line.x2 = x2
        Line.y2 = y2

    def draw(self):
        self.w.create_line(Line.x1, Line.y1, Line.x2, Line.y2)
Esempio n. 3
0
    def for_screen(self, tokens, obj, func_for_class_obj, class_obj):
        if tokens[len(obj) + 1:] in func_for_class_obj:

            self.dict_class_with_used_func[class_obj] = tokens[len(obj) + 1:]

            index = self.tokenised_list.index(tokens)
            w = self.tokenised_list[index + 2]
            h = self.tokenised_list[index + 4]

            s = Screen()
            s.set_screen_dimen(w, h)
            return 1

        else:
            return 0
Esempio n. 4
0
 def draw(self):
     width, height = Screen().get_screen_dimen()
     x = int(width) / 2
     y = int(height) / 2
     self.w.create_oval(x - Circle.radius,
                        y - Circle.radius,
                        x + Circle.radius,
                        y + Circle.radius,
                        fill=Circle.fill_color)
Esempio n. 5
0
class Rectangle(object):
    x1, x2, y1, y2 = 0, 0, 0, 0
    fill_color = ''

    def __init__(self):
        self.w = Screen().w

    def set_rect_dimensions(self, x1, y1, x2, y2):
        Rectangle.x1 = x1
        Rectangle.y1 = y1
        Rectangle.x2 = x2
        Rectangle.y2 = y2

    def draw(self):
        self.w.create_rectangle(Rectangle.x1, Rectangle.y1, Rectangle.x2, Rectangle.y2, fill=Rectangle.fill_color)

    def set_fill_color(self, fill_color):
        Rectangle.fill_color = fill_color
Esempio n. 6
0
 def draw(self):
     width, height = Screen().get_screen_dimen()
     x = int(width) / 2
     y = int(height) / 2
     s = Square.side / 2
     self.w.create_rectangle(x - s,
                             y - s,
                             x + s,
                             y + s,
                             fill=Square.fill_color)
Esempio n. 7
0
class Polygon(object):

    points = []
    fill_color = ''

    def __init__(self):
        self.w = Screen().w

    def set_points(self, points):
        Polygon.points = points

    def draw(self):
        # print Polygon.points
        self.w.create_polygon(Polygon.points,
                              outline='#000',
                              fill=Polygon.fill_color)

    def set_fill_color(self, fill_color):
        Polygon.fill_color = fill_color
Esempio n. 8
0
class Circle(object):
    radius = 0
    fill_color = ''

    def __init__(self):
        self.w = Screen().w

    def set_radius(self, radius):
        Circle.radius = radius

    def draw(self):
        width, height = Screen().get_screen_dimen()
        x = int(width) / 2
        y = int(height) / 2
        self.w.create_oval(x - Circle.radius,
                           y - Circle.radius,
                           x + Circle.radius,
                           y + Circle.radius,
                           fill=Circle.fill_color)

    def set_fill_color(self, fill_color):
        Circle.fill_color = fill_color
Esempio n. 9
0
class Square(object):
    side = 0
    fill_color = ''

    def __init__(self):
        self.w = Screen().w

    def set_side_length(self, side):
        Square.side = side

    def draw(self):
        width, height = Screen().get_screen_dimen()
        x = int(width) / 2
        y = int(height) / 2
        s = Square.side / 2
        self.w.create_rectangle(x - s,
                                y - s,
                                x + s,
                                y + s,
                                fill=Square.fill_color)

    def set_fill_color(self, fill_color):
        Square.fill_color = fill_color
Esempio n. 10
0
def use_screen():
    s = Screen()
    width, height = s.get_screen_dimen()
    s.make(master=master)
Esempio n. 11
0
 def __init__(self):
     self.w = Screen().w