コード例 #1
0
ファイル: inter_node.py プロジェクト: TLoebner/apbteam
 def __init__ (self, tick):
     Inter.__init__ (self)
     # Create node and bind to Tk.
     self.node = Node ()
     self.node.tick = tick # tick/s
     self.tk.createfilehandler (self.node, READABLE, self.read)
     # Animation attributes.
     self.date = 0
     self.synced = True
     self.step_after = None
     self.step_time = None
コード例 #2
0
ファイル: inter_node.py プロジェクト: TLoebner/apbteam
 def create_widgets (self):
     Inter.create_widgets (self)
     self.now_label = Label (self.right_frame, text = 'Now: 0 s')
     self.now_label.pack ()
     self.step_button = Button (self.right_frame, text = 'Step',
             command = self.step)
     self.step_button.pack ()
     self.step_size_scale = Scale (self.right_frame, orient = HORIZONTAL,
             from_ = 0.05, to = 1.0, resolution = 0.05)
     self.step_size_scale.pack ()
     self.play_var = IntVar ()
     self.play_button = Checkbutton (self.right_frame,
             variable = self.play_var, text = 'Play', command = self.play,
             underline = 0)
     self.play_button.pack ()
     self.bind_all ('p', lambda event: self.play_button.invoke ())
コード例 #3
0
ファイル: table_eurobot2011.py プロジェクト: TLoebner/apbteam
            for j in xrange (0, 6):
                if (i + j) % 2:
                    self.draw_rectangle ((1500 + i * 350, j * 350),
                            (1850 + i * 350, 350 + j * 350), fill = RED)
        # Bonus.
        for i, j in ((0, 0), (1, 2), (1, 4)):
            self.draw_circle ((1500 - 175 - i * 350, 175 + j * 350), 50, fill = BLACK)
            self.draw_circle ((1500 + 175 + i * 350, 175 + j * 350), 50, fill = BLACK)
        # Protected zones.
        self.draw_both (self.draw_rectangle, (1500 - 3 * 350, 0), (1500 - 350, 120), fill = BLACK)
        self.draw_both (self.draw_rectangle, (1500 - 3 * 350, 120), (1500 - 3 * 350 + 22, 120 + 130), fill = BLACK)
        self.draw_both (self.draw_rectangle, (1500 - 350, 120), (1500 - 350 - 22, 120 + 130), fill = BLACK)
        self.draw_both (self.draw_rectangle, (1500 - 350, 120 + 130), (1500 - 350 - 20, 350), fill = BLACK)
        self.draw_both (self.draw_rectangle, (1500 - 3 * 350, 350 - 20), (1500 - 350, 350), fill = BLACK)
        # Axes.
        self.draw_line ((0, 200), (0, 0), (200, 0), arrow = 'both')
        # Beacons.
        self.draw_both (self.draw_rectangle, (-22, 2100 + 22), (-22 - 80, 2100 + 22 + 80), fill = BLACK)
        self.draw_both (self.draw_rectangle, (-22, 1050 - 40), (-22 - 80, 1050 + 40), fill = BLACK)
        self.draw_both (self.draw_rectangle, (-22, -80 - 22), (-22 - 80, -22), fill = BLACK)
        # Children.
        Drawable.draw (self)

if __name__ == '__main__':
    from simu.inter.inter import Inter
    import simu.model.table_eurobot2011 as model
    app = Inter ()
    m = model.Table ()
    Table (app.table_view, m)
    app.mainloop ()