예제 #1
0
def createFilledCircle(x, y, r, fill='black', border=None):
    circle = GOval(x - r, y - r, 2 * r, 2 * r)
    circle.setFilled(True)
    if border is None:
        circle.setColor(fill)
    else:
        circle.setColor(border)
        circle.setFillColor(fill)
    return circle
예제 #2
0
def createButton(s):# makes a button with the string s
    button=GCompound()
    buttonSize=75
    label=GLabel(s)
    label.setColor("white")
    label.setFont("8px 'Sans-Serif'")
    c=GOval(-(label.getWidth()+20)//2,-buttonSize//2,label.getWidth()+20,buttonSize)
    c.setFillColor("black")
    c.setFilled(True)
    button.add(c)
    button.add(label,-label.getWidth()//2,0)
    return button
예제 #3
0
    def __init__(self, letter):
        GCompound.__init__(self)

        lamp = GOval(LAMP_RADIUS * 2, LAMP_RADIUS * 2)
        lamp.setColor(LAMP_BORDER_COLOR)
        lamp.setFillColor(LAMP_BGCOLOR)
        self.add(lamp, -LAMP_RADIUS, -LAMP_RADIUS)  # create design for lamps

        self.ch = GLabel(letter)
        self.ch.setColor(LAMP_OFF_COLOR)
        self.ch.setFont(LAMP_FONT)
        self.add(self.ch, -self.ch.getWidth() / 2, LAMP_LABEL_DY)
예제 #4
0
    def __init__(self, letter):
        GCompound.__init__(self)

        key = GOval(KEY_RADIUS * 2, KEY_RADIUS * 2)
        key.setLineWidth(KEY_BORDER)
        key.setColor(KEY_BORDER_COLOR)
        key.setFillColor(KEY_BGCOLOR)
        self.add(key, -KEY_RADIUS, -KEY_RADIUS)  # create design for keys

        self.ch = GLabel(letter)
        self.ch.setColor(KEY_UP_COLOR)
        self.ch.setFont(KEY_FONT)

        self.add(self.ch, -self.ch.getWidth() / 2, KEY_LABEL_DY)
예제 #5
0
def create_filled_circle(x, y, r, fill="Black", border=None):
    """
    Creates a circle of radius r centered at the point (x, y) with the
    specified fill color.  If border is specified, the border appears
    in that color.
    """
    circle = GOval(x - r, y - r, 2 * r, 2 * r)
    circle.setFilled(True)
    if border is None:
        circle.setColor(fill)
    else:
        circle.setColor(border)
        circle.setFillColor(fill)
    return circle
예제 #6
0
 def __init__(self):
    GCompound.__init__(self)
    self.digit = ""
    outer = GOval(-20, -20, 40, 40)
    outer.setFilled(True)
    outer.setFillColor("red")
    outer.setColor("red")
    self.add(outer)
    outer = GOval(-16, -16, 32, 32)
    outer.setFilled(True)
    outer.setFillColor("white")
    outer.setColor("white")
    self.add(outer)
    strikethrough = GLine(15, -15, -15, 15)
    strikethrough.setLineWidth(6)
    strikethrough.setColor("red")
    self.add(strikethrough)
예제 #7
0
class Circle(GCompound):
    def __init__(self, diameter, color, filled=True):
        super().__init__()
        self.oval = GOval(-diameter // 2, -diameter // 2, diameter, diameter)
        self.oval.setFillColor(color)
        self.oval.setColor(color)
        self.oval.setFilled(filled)
        self.diameter = diameter
        self.add(self.oval)

    def set_color(self, color):
        self.oval.setColor(color)
        self.oval.setFillColor(color)

    def get_radius(self):
        return self.diameter / 2

    def get_center(self):
        return (self.getX(), self.getY())
예제 #8
0
def filledCircle(x, y, diameter, color):
    circle = GOval(x, y, diameter, diameter)
    circle.setFilled(True)
    circle.setFillColor(color)
    return circle