Example #1
0
 def add_node(g, i):
     node = nd.Node()
     q = qu.Quadrant(i)
     p = tplane.tangent_plane()
     node.objects.append(q)
     q.objects.append(p)
     g.add_node(i, node)
 def add_node(self,g,DNA):
     node=nd.Node()
     q=qu.Quadrant(DNA)
     p=tplane.tangent_plane()
     node.objects.append(q)
     q.objects.append(p)
     g.add_node(DNA,node)
Example #3
0
def load(tree, list):
    Nodes_button = []
    display_width = tree.objects[0].shape[0][1]
    display_height = tree.objects[0].shape[1][1]
    for button in list:
        n = button[2]
        pos = [button[0], button[1]]
        scale = button[2]
        action = button[3]
        p = coordinate(pos, scale, tree)
        Lx = tree.objects[0].shape[0][1]
        Ly = tree.objects[0].shape[1][1]
        dx = Lx / (2**n)
        dy = Ly / (2**n)
        Node = qu.Find(p, tree)
        Node.objects[0].objects.append(
            Button(action=actions[action],
                   image=pygame.image.load('drone.png')))
        button = Node.objects[0].objects[0]
        ima = button.image
        b = pygame.transform.scale(
            ima, (int(display_width / (2**n)), int(display_height / (2**n))))
        button.image = b
        Nodes_button.append(Node)
    return Nodes_button
Example #4
0
program.initialize_parameters(Status)
program.create_objects(Status)

pygame.init()

n=5
#display_width = 1500
#display_height = 700

display_width = 400
display_height = 400

#Initializes sectors and load buttons on them

sectors=nd.Node()
sectors.objects.append(qu.Quadrant([[0,display_width],
    [0,display_height]]))
qu.Divide(sectors,n)
Node_buttons=bu.load(sectors,[[3,3,n,'run_stop'],[6,3,n,'initialize'],
    [3,6,n,'beta'],[9,3,n,'num_particels'],
        [12,3,n,'dt'],[15,3,n,'dx'],[18,3,n,'alpha'],[3,9,n,'r_value']])



gameDisplay = pygame.display.set_mode((display_width,display_height))
pygame.display.set_caption('Gui')

black = (0,0,0)
white = (255,255,255)

clock = pygame.time.Clock()
crashed = False