def za_8():
    krogi = []
    for i in range(30):
        krog = risar.krog(
            randint(15, risar.maxX - 15), randint(15, risar.maxY - 15), 10,
            risar.barva(randint(0, 150), randint(0, 150), randint(0, 150)), 3)
        krogi.append([krog, 2 * random() + 3, 2 * random() + 3])
    miska = risar.krog(risar.miska[0], risar.miska[1], 30,
                       risar.barva(255, 255, 255), 3)
    for i in range(1000):
        if not risar.klik:
            checkx, checky = risar.miska
            miska.setPos(checkx, checky)
        for n in range(len(krogi)):
            item, new_x, new_y = krogi[n]
            item.setPos(item.x() + new_x, item.y() + new_y)
            if checkx-33 < item.x() < checkx+33 \
                    and checky-33 < item.y() < checky+33 and risar.klik:
                exit()
            if not (15 < item.x() < risar.maxX - 15):
                krogi[n][1] = -new_x
                #risar.barvaOzadja(risar.barva(randint(0, 255), randint(0, 255), randint(0, 255)))
            if not (15 < item.y() < risar.maxY - 15):
                #risar.barvaOzadja(risar.barva(randint(0, 255), randint(0, 255), randint(0, 255)))
                krogi[n][2] = -new_y

        risar.cakaj(0.02)
Пример #2
0
def narisi_kraje(kraji):
    oznake = {}
    for ime, x, y in kraji:
        risar.krog(tx(x), ty(y), 2)
        b = oznake[ime] = risar.besedilo(tx(x), ty(y), ime, velikost=12)
        r = b.boundingRect()
        b.setPos(b.x() - r.width() / 2, b.y() - r.height())
    return oznake
Пример #3
0
    def __init__(self):
        self.x, self.y = risar.maxX // 2, risar.maxY // 2
        self.angle = 0
        self.penActive = True

        self.pause = 0
        self.body = risar.krog(0, 0, 5, risar.zelena, 3)
        self.head = risar.krog(0, 0, 2, risar.zelena, 3)
        self.update()
Пример #4
0
 def __init__(self):
     self.x = risar.maxX / 2
     self.y = risar.maxY / 2
     self.angle = 0
     self.pen_active = True
     self.pause = 0
     self.body = risar.krog(0, 0, 5, risar.zelena, 3)
     self.head = risar.krog(0, 0, 2, risar.zelena, 3)
     self.update()
Пример #5
0
 def __init__(self):
     self.x = risar.maxX / 2
     self.y = risar.maxY / 2
     self.angle = 0
     self.pen_active = True
     self.pause = 0
     self.body = risar.krog(0, 0, 5, risar.zelena, 3)
     self.head = risar.krog(0, 0, 2, risar.zelena, 3)
     self.update()
     self.seznam = []
Пример #6
0
    def __init__(self):
        self.x, self.y = risar.maxX / 2, risar.maxY / 2
        self.angle = 0
        self.penActive = True
        self.width = 1  ## DODANO ##
        self.color = risar.bela  ## DODANO ##

        self.pause = 0
        self.body = risar.krog(0, 0, 5, risar.zelena, 3)
        self.head = risar.krog(0, 0, 2, risar.zelena, 3)
        self.update()
Пример #7
0
    def stamp(self):
    angle = radians(90 - self.angle)
    body = risar.krog(self.x, self.y, 5, risar.zelena, 3)
    head = risar.krog(self.x+5*cos(angle), self.y-5*sin(angle), 2, risar.zelena, 3)
    self.stamps.append(body)
    self.stamps.append(head)

    def clearStamps(self):
        for stamp in self.stamps:
            stamp.hide()
        self.stamps = []
Пример #8
0
 def __init__(self):
     self.ime = "Barb"
     self.x = risar.maxX / 2
     self.y = risar.maxY / 2
     self.angle = 0
     self.pen_active = True
     self.body = risar.krog(0, 0, 5, risar.zelena, 3)
     self.head = risar.krog(0, 0, 3, risar.zelena, 3)
     self.update()
     self.pause = 0
     self.color = "bela"
     self.width = 1
Пример #9
0
def za_8():
    '''
    Draws 30 circles at random positions, moves the around. Draws an extra circle, around mouse coordinates.
    Mouse circle follows mouse until first left click. After the click circle stops, program terminates when first
    circle touches mouse circle.
    Speed of movement is 5, circles bounce upon hitting edge.
    Calls create_circles, to create actual objects.
    :return:
    '''
    krogi = create_circles(30)
    miska = risar.krog(risar.miska[0], risar.miska[1], 30,
                       risar.barva(255, 255, 255), 3)

    while True:
        if not risar.klik:
            checkx, checky = risar.miska
            miska.setPos(checkx, checky)
        for n in range(len(krogi)):
            item, new_x, new_y, *s = krogi[n]
            item.setPos(item.x() + new_x, item.y() + new_y)
            if checkx-33 < item.x() < checkx+33 \
                    and checky-33 < item.y() < checky+33 and risar.klik:
                     exit()
            if not (15 < item.x() < risar.maxX - 15):
                krogi[n][1] = -new_x
            if not (15 < item.y() < risar.maxY - 15):
                krogi[n][2] = -new_y
        risar.cakaj(0.02)
Пример #10
0
def naloga8_pomembnost():
    from collections import defaultdict

    oznake = naloga6_povezave(False, True)
    kraji = TestBase.kraji
    pov = dvosmerno(povezave(5, kraji))
    koord = koordict(kraji)
    barve = [risar.modra, risar.zelena, risar.rumena, risar.rdeca, risar.rjava]
    zacetki = [random.choice(kraji)[0] for _ in range(5)]
    poti = list(zip(*(potnik(zacetek, 1000, pov) for zacetek in zacetki)))
    krogi = [risar.krog(tx(koord[zacetek][0]), ty(koord[zacetek][1]),
                        5, sirina=4, barva=barva)
             for zacetek, barva in zip(zacetki, barve)]

    obiski = defaultdict(int)
    for kraji0, kraji1 in zip(poti, poti[1:]):
        for kraj in kraji0:
            obiski[kraj] += 1
            oznake[kraj].setPlainText(f"{kraj}: {obiski[kraj]}")
        xy0 = [koord[kraj] for kraj in kraji0]
        xy1 = [koord[kraj] for kraj in kraji1]
        for i in [0.1, 0.3, 0.6, 0.9, 1]:
            for (x0, y0), (x1, y1), krog in zip(xy0, xy1, krogi):
                krog.setPos(tx(x0 * (1 - i) + x1 * i), ty(y0 * (1 - i) + y1 * i))
            risar.cakaj(0.005)
    risar.stoj()
Пример #11
0
    def __init__(self):

        #params
        self.steviloZog = 30
        self.casEksplozije = 4
        self.waitCas = 0.02

        self.obsegBig = 30
        self.obsegSmall = 10

        self.sirinaKroga = 3
        #params--end

        self.miskaKlik = None
        self.laufa = True
        self.konecRecall = False

        self.zoge = []
        self.steviloEksplozij = 0

        zogaId = 0
        while len(self.zoge) < self.steviloZog:
            self.zoge.append(
                Zoga(zogaId, risar.nakljucna_barva(), self.sirinaKroga,
                     self.obsegSmall, None, None))
            zogaId += 1

        self.miskaKrog = risar.krog(risar.miska[0], risar.miska[1],
                                    self.obsegBig, risar.bela,
                                    self.sirinaKroga)
def create_circles(stevilo):
    krogi = []
    for i in range(stevilo):
        krog = risar.krog(
            randint(30, risar.maxX - 30), randint(30, risar.maxY - 30), 10,
            risar.barva(randint(0, 150), randint(0, 150), randint(0, 150)), 3)
        krogi.append([krog, 2 * random() + 3, 2 * random() + 3, 0, 0, False])
    return krogi
Пример #13
0
    def __init__(self):
        self.x, self.y = risar.maxX // 2, risar.maxY // 2
        self.angle = 0
        self.penActive = True

        self.pause = 1
        self.body = risar.krog(0, 0, 5, risar.zelena, 3)
        self.head = risar.krog(0, 0, 2, risar.zelena, 3)
        self.pen = risar.krog(0, 0, 2, risar.rumena, 3)
        self.update()

        self.width = 1
        self.color = risar.bela

        self.stamps = []

        self. macro = []
Пример #14
0
    def __init__(self):
        self.x, self.y = risar.maxX // 2, risar.maxY // 2
        self.angle = 0
        self.penActive = True

        self.pause = 0
        self.body = risar.krog(0, 0, 5, risar.zelena, 3)
        self.head = risar.crta(0, 0, 5, risar.rdeca, 3)
        self.update()
Пример #15
0
 def __init__(self):
     self.radius = 10
     self.color = risar.nakljucna_barva()
     self.x = random.randint(self.radius + 5, risar.maxX - (self.radius + 5))
     self.y = random.randint(self.radius + 5, risar.maxY - (self.radius + 5))
     self.angle = random.randint(0, 360)
     self.head = risar.krog(self.x, self.y, self.radius, self.color)
     self.exploded = False
     self.timer = risar.QTimer()
     self.move_x = random.choice([-5, 5])
     self.move_y = random.choice([-5, 5])
 def __init__(self):
     self.hitrost = round(random.uniform(0, 4), 2)
     self.kot = random.randint(0, 360)
     self.x, self.y = random.randint(4, risar.maxX - 4), random.randint(
         4, risar.maxY - 4)
     self.krog = risar.krog(self.x, self.y, 5)
     self.okuzen = False
     self.prebolel = False
     self.dnevi_zdravljenja = 0
     self.dnevi_izolacije = 0
     self.v_izoliciji = False
Пример #17
0
def naloga7_potnik():
    naloga6_povezave(False, True)
    pov = dvosmerno(povezave(5, TestBase.kraji))
    kraji = TestBase.kraji
    koord = koordict(kraji)
    pot = potnik(random.choice(kraji)[0], 1000, pov)
    krog = risar.krog(0, 0, 5, sirina=4, barva=risar.zelena)
    for kraj0, kraj1 in zip(pot, pot[1:]):
        x0, y0 = koord[kraj0]
        x1, y1 = koord[kraj1]
        for i in [0.1, 0.3, 0.6, 0.9, 1]:
            krog.setPos(tx(x0 * (1 - i) + x1 * i), ty(y0 * (1 - i) + y1 * i))
            risar.cakaj(0.005)
Пример #18
0
    def eksplodirajMe(self):

        self.eksplodiranost = {'koord': [self.x, self.y], 'cajt': time()}

        eksplodiran_krog = risar.krog(self.x, self.y, kontekst.obsegBig,
                                      self.barva, kontekst.sirinaKroga)
        c = eksplodiran_krog.pen().color().lighter()
        c.setAlpha(100)
        eksplodiran_krog.setBrush(c)

        self.r = kontekst.obsegBig

        return eksplodiran_krog
Пример #19
0
 def __init__(self, barva):
     self.moving = True
     self.r = 10
     self.x = random.randint(2 * self.r, risar.maxX - 2 * self.r)
     self.y = random.randint(2 * self.r, risar.maxY - 2 * self.r)
     if not barva:
         self.barva = risar.nakljucna_barva()
     else:
         self.barva = risar.bela
     self.krog = risar.krog(self.x, self.y, self.r, self.barva)
     self.vx = random.uniform(-5, 5)
     self.vy = math.sqrt(hitrost**2 - self.vx**2)
     self.explosion = False
     self.already_exploded = False
def za_6():
    krog = risar.krog(
        randint(15, risar.maxX - 15), randint(15, risar.maxY - 15), 10,
        risar.barva(randint(0, 255), randint(0, 255), randint(0, 255)), 3)
    x, y = 2 * random() + 3, 2 * random() + 3
    t = time.time()
    for i in range(1000):
        if time.time() - t > 20:
            exit()
        krog.setPos(krog.x() + x, krog.y() + y)
        if not (15 < krog.x() < risar.maxX - 15):
            x = -x
        if not (15 < krog.y() < risar.maxY - 15):
            y = -y
        risar.cakaj(0.02)
Пример #21
0
 def __init__(self, color=risar.bela, size=10, fill=False):
     self.speed = 5
     self.wall = (risar.maxX, risar.maxY)
     self.course_x = randint(-self.speed, self.speed)
     self.course_y = sqrt(self.speed**2-self.course_x**2)
     self.coordinates = (randint(10, self.wall[0] - 5), randint(10, self.wall[1]) - 5)
     self.size = size
     self.color = color
     self.fill = fill
     self.mouse = False
     self.placed = False
     self.hit = False
     self.removed = False
     self.hit_processed = False
     self.ball = self.ball = risar.krog(self.coordinates[0], self.coordinates[1], self.size, self.color, self.fill)
Пример #22
0
def create_circles(stevilo):
    '''
    Creates a list for each object risar.krog with random coordinates, random radius, random color and thickness of 5.
    Values stored in list are: risar.krog object, horizontal speed, vertical speed, counter, explosion start time
    and explotion status bool.

    New speed is calculated using pythagorean theorem.
    Function returns a list of lists if there is more than 1 circle created otherwise it returns a single list with
    above values.
    :param stevilo:
    :return:
    '''
    krogi = []
    for i in range(stevilo):
        krog = risar.krog(randint(30, risar.maxX - 30), randint(30, risar.maxY - 30), 10,
                          risar.barva(randint(30, 240), randint(30, 240), randint(30, 240)), 5)
        x = choice([-4, -3, -2, -1, 1, 2, 3, 4])
        y = math.sqrt((5**2)-(x**2))
        krogi.append([krog, x, y, 0, 0, False])
        print(math.sqrt(x**2 + y**2))
    return krogi if len(krogi)>1 else krogi[0]
def za_7():
    krogi = []
    for i in range(30):
        krog = risar.krog(
            randint(15, risar.maxX - 15), randint(15, risar.maxY - 15), 10,
            risar.barva(randint(0, 255), randint(0, 255), randint(0, 255)), 3)
        krogi.append([krog, 2 * random() + 3, 2 * random() + 3])
    t = time.time()
    for i in range(1000):

        for i in range(1000):
            if time.time() - t > 20:
                exit()
        for n in range(len(krogi)):
            item, new_x, new_y = krogi[n]
            item.setPos(item.x() + new_x, item.y() + new_y)
            if not (15 < item.x() < risar.maxX - 15):
                krogi[n][1] = -new_x
                #risar.barvaOzadja(risar.barva(randint(0, 255), randint(0, 255), randint(0, 255)))
            if not (15 < item.y() < risar.maxY - 15):
                #risar.barvaOzadja(risar.barva(randint(0, 255), randint(0, 255), randint(0, 255)))
                krogi[n][2] = -new_y

        risar.cakaj(0.02)
Пример #24
0
import risar
from random import random, randint
from time import time
from math import sqrt
risar.obnavljaj = True

cas = time()
krogi = []
kx = []
ky = []
mx, my = risar.miska
speed = 5
miskaKrog = risar.krog(mx, my, 30, sirina=5)

for i in range(30):
    barva = risar.barva(randint(0, 255), randint(0, 255), randint(0, 255))
    pos = risar.nakljucne_koordinate()
    if pos[0] < risar.maxX or pos[1] < risar.maxY:
        pos = risar.nakljucne_koordinate()
    else:
        break
    krogi.append((risar.krog(pos[0], pos[1], 10, barva, sirina=2)))
    kx.append(randint(-5, 5))
    ky.append(sqrt(speed**2 - kx[i]**2))

while True:

    if risar.levo:
        mx, my = risar.miska
        cas = time()
Пример #25
0
import random

import risar

sez = []
for i in range(50):
    x, y, r = random.randint(20, risar.maxX - 20), random.randint(20, risar.maxY - 20), random.randint(5, 20)
    risar.krog(x, y, r, barva=risar.nakljucna_barva())
    sez.append((x, y))

for x, y in sez:
    for x1, y1 in sez:
        risar.crta(x, y, x1, y1, barva = risar.nakljucna_barva())
risar.stoj()
Пример #26
0
import math
import random
import risar

krogi = []
while len(krogi) < 1000:
    x, y = risar.nakljucne_koordinate()
    r = random.randint(20, 80)
    for xx, yy, rr in krogi:
        dist = math.sqrt((xx - x)**2 + (yy - y)**2)
        r = min(r, dist - rr)
        if dist <= rr:
            break
    else:
        krogi.append((x, y, r))
        risar.krog(x, y, r)
risar.stoj()
Пример #27
0
def za_10_game(krogov):
    '''
    Draws x circles - krogov - at random positions, moves them around. Draws an extra circle, around mouse coordinates.
    Mouse circle follows mouse until first left click. After the click mouse circle stops, each circle that touches
    that circle explodes, thus creating another explosion node. Each circle that touches an explosion node, explodes
    as well. Program ends when there is no more exploded circles on canvas or time runs out. It display how many circles
    have exploded and terminates.
    Speed of movement is 5, circles bounce upon hitting edge.
    Explotion time is 4 seconds. Runout time is 20 seconds.
    Calls create_circles, to create actual objects.
    :return:
    '''

    krogi = create_circles(krogov)

    miska = risar.krog(risar.miska[0], risar.miska[1], 30,
                       risar.barva(255, 255, 255), 3)

    miska_start = 0
    miska_klik = False
    stevec = 0
    stop_koordinate = {"miska": (risar.miska[0], risar.miska[1])}
    while True:
        if not risar.klik:
            stop_koordinate["miska"] = (risar.miska[0], risar.miska[1])
            miska.setPos(risar.miska[0], risar.miska[1])

        for n in range(len(krogi)):
            item, new_x, new_y, count, startime, status = krogi[n]
            if time.time() - miska_start >= 4 and miska_klik:
                miska.hide()
                miska_klik = False
                del stop_koordinate["miska"]
                if len(stop_koordinate) == 0:
                    return stevec
            if startime != 0 and time.time() - krogi[n][4] >= 4:
                item.hide()
                krogi[n][4] = 0
                del stop_koordinate[item]
                if len(stop_koordinate) == 0:
                    return stevec
                continue
            elif status == True:
                continue
            item.setPos(item.x() + new_x, item.y() + new_y)
            if risar.klik and miska_start == 0:
                pobarvaj(miska, 200)
                miska_start = time.time()
                miska_klik = True
            for x, y in stop_koordinate.values():
                if x - 35.0 < item.x() < x + 35.0 and y - 35.0 < item.y() < y + 33.0 and risar.klik:
                    item.setRect(-30, -30, 60, 60)
                    pobarvaj(item, randint(120, 180))
                    stop_koordinate[item] = (item.x(), item.y())
                    krogi[n][4] = time.time()
                    krogi[n][5] = True
                    stevec += 1
                    break
            if not (15 < item.x() < risar.maxX - 15):
                krogi[n][1] = -new_x
            if not (15 < item.y() < risar.maxY - 15):
                krogi[n][2] = -new_y
        risar.cakaj(0.02)
Пример #28
0
import risar
import time

import time
from random import randint, random, choice
x, y = risar.nakljucne_koordinate()
vx, vy = randint(-5, 5), randint(-5, 5)
barva = risar.nakljucna_barva()
r = 10

cas = time.time()
t = 0.02

risar.krog(x, y, r, barva, sirina=1)
while True:

    if x < r:
        vx = abs(vx)
    if x > risar.maxX - r:
        vx = -abs(vx)
    if y < r:
        vy = abs(vy)
    if y > risar.maxY - r:
        vy = -abs(vy)

    x += vx
    y += vy
    risar.krog(x, y, 10, barva, sirina=1)
    risar.cakaj(t)
    risar.pobrisi()
    c = abs(cas - time.time())
Пример #29
0
 def __init__(self):
     self.x, self.y = risar.miska
     self.head = risar.krog(self.x, self.y, 30)
     self.clicked = False
     self.timer = risar.QTimer()
def za_10_game(krogov):
    st = time.clock()

    krogi = create_circles(krogov)

    miska = risar.krog(risar.miska[0], risar.miska[1], 30,
                       risar.barva(255, 255, 255), 3)

    miska_start = 0
    miska_klik = False
    stevec = 0
    stop_koordinate = {"miska": (risar.miska[0], risar.miska[1])}
    for s in range(1000):
        if not risar.klik:
            stop_koordinate["miska"] = (risar.miska[0], risar.miska[1])
            miska.setPos(risar.miska[0], risar.miska[1])

        for n in range(len(krogi)):
            item, new_x, new_y, count, startime, status = krogi[n]
            if time.time() - miska_start >= 4 and miska_klik:
                miska.hide()
                miska_klik = False
                del stop_koordinate["miska"]
                if len(stop_koordinate) == 0:
                    return stevec
            if startime != 0 and time.time() - krogi[n][4] >= 4:
                item.hide()
                krogi[n][4] = 0
                del stop_koordinate[item]
                if len(stop_koordinate) == 0:
                    return stevec
                continue

            elif status == True:
                continue
            item.setPos(item.x() + new_x, item.y() + new_y)
            if risar.klik and miska_start == 0:
                pobarvaj(miska, 150)
                '''color = miska.pen().color().lighter()
                color.setAlpha(150)
                miska.setBrush(color)'''
                miska_start = time.time()
                miska_klik = True
            for x, y in stop_koordinate.values():
                if x - 35.0 < item.x() < x + 35.0 and y - 35.0 < item.y(
                ) < y + 33.0 and risar.klik:
                    item.setRect(-30, -30, 60, 60)
                    '''color = item.pen().color().lighter()
                        color.setAlpha(randint(120, 180))
                        item.setBrush(color)'''
                    pobarvaj(item, randint(120, 180))
                    stop_koordinate[item] = (item.x(), item.y())
                    krogi[n][4] = time.time()

                    krogi[n][5] = True
                    stevec += 1
                    break

            if not (15 < item.x() < risar.maxX - 15):
                krogi[n][1] = -new_x
            if not (15 < item.y() < risar.maxY - 15):
                krogi[n][2] = -new_y
        risar.cakaj(0.02)
        if time.clock() - st > 20:
            break
    return stevec
import risar
from math import *
from random import randint, choice
import time
from PyQt5.QtWidgets import QMessageBox

zoge = []
vx = []
vy = []
barve = [barva for barva in risar.barve if barva != risar.crna]

for i in range(30):
    #barva = risar.barva(randint(0, 255), randint(0, 255), randint(0, 255))
    barva = choice(barve)
    x, y = randint(10, risar.maxX - 10), randint(10, risar.maxY - 10)
    krog = risar.krog(x, y, 10, barva, 1)
    zoge.append(krog)
    vx_item = randint(-5, 5)
    vy_item = sqrt(5**2 - vx_item**2)
    vx.append(vx_item)
    vy.append(vy_item)

cas = time.time()
miska = risar.krog(risar.miska[0], risar.miska[1], 30, risar.bela)
while 1:
    if time.time() - cas >= 20:
        exit("Poteklo je 20s")
    if not risar.klik:
        miska.setPos(risar.miska[0], risar.miska[1])
    for i in range(len(zoge)):
        zoga = zoge[i]
Пример #32
0
sez = []

xc, yc, r = risar.maxX / 2, risar.maxY / 2, 200
n = 25
angle = 2 * math.pi / n

ys = []
for i in range(n):
    ny = round((r * math.sin(angle * i)), 4)
    ys.append(ny)

xs = []
for i in range(n):
    ny = round((r * math.cos(angle * i)), 4)
    xs.append(ny)

sredisca = zip(xs, ys)

r = 200 * math.sin(angle / 2)

for x, y in sredisca:
    risar.krog(x + xc, y + yc, r, barva=risar.nakljucna_barva())
    sez.append((x + xc, y + yc))

for x, y in sez:
    for x1, y1 in sez:
        risar.crta(x, y, x1, y1, barva = risar.nakljucna_barva())

risar.stoj()
Пример #33
0
 def ustvariKrogObject(self):
     self.zogca = risar.krog(self.x, self.y, self.r, self.barva,
                             self.sirina)
Пример #34
0
 def stamp(self):
     angle = radians(90 - self.angle)
     self.stamps.append(risar.krog(self.x, self.y, 5, risar.zelena, 3))
     self.stamps.append(risar.krog(self.x + 5 * cos(angle), self.y - 5 * sin(angle), 3, risar.zelena, 3))
Пример #35
0
import risar
import time
from random import *

#NALOGA ZA 6

spremenljiva_x = randint(1, 5) * 2
spremenljiva_y = randint(1, 5) * 2
y = risar.maxY - 12
x = risar.maxX - 12
konec = time.time() + 20
krog = risar.krog(randint(0, y),
                  randint(0, y),
                  10,
                  barva=risar.nakljucna_barva(),
                  sirina=3)

while (time.time() < konec):
    krog.setPos(krog.x() + spremenljiva_x, krog.y() + spremenljiva_y)
    if not (12 < krog.x() < x):
        spremenljiva_x = -spremenljiva_x
    if not (12 < krog.y() < y):
        spremenljiva_y = -spremenljiva_y
    risar.cakaj(0.01)

#NALOGA ZA 7

seznam_krog = []
spremenljiva_x = []
spremenljiva_y = []
y = risar.maxY - 12
Пример #36
0
import math
import risar

n = 20  # Število manjših krogov
R = 200  # Radij velikega kroga
x0, y0 = risar.maxX / 2, risar.maxY / 2  # Središče velikega kroga
krogi = []
for i in range(n):
    phi = 2 * math.pi / n
    x = x0 + R * math.cos(phi * i)
    y = y0 + R * math.sin(phi * i)
    barva = risar.nakljucna_barva()
    r = math.sin(phi / 2) * R
    risar.krog(x, y, r, barva)
    for xx, yy in krogi:
        risar.crta(x, y, xx, yy, barva)
    krogi.append((x, y))
risar.stoj()