コード例 #1
0
    def on_key_down(self, event):
        key = event.key

        self.set_direction(event)  # set direction

        rate(self.__cube.fps)
        if key == self.__x_key:
            self.__cube.turn_x(random.randint(0, 3), self.__direction)
        elif key == self.__y_key:
            self.__cube.turn_y(random.randint(0, 3), self.__direction)
        elif key == self.__z_key:
            self.__cube.turn_z(random.randint(0, 3), self.__direction)
        rate(self.__cube.fps)
コード例 #2
0
 def turn_z(self, event):
     rate(self.__cube.fps)
     self.__cube.turn_z(self.__index, self.__direction)
     rate(self.__cube.fps)
コード例 #3
0
ファイル: main.py プロジェクト: ymekesser/LED-Cube-Prototyper
import Controller
from LedCube import LedCube
from visual_common import create_display

# # # # MAIN means start the application --> HERE <-- # # # #

# initialize led_cube and controller
led_cube = LedCube()
Controller.start(led_cube)

# vpython bs
while True:
    # caps the vpython framerate to 60fps
    create_display.rate(60)