from tkinter import ttk """Parámetros para Comunicación Serial""" port= serial.Serial('COM4', 115200, timeout=1.0) port.set_buffer_size(5, 1) port.flushInput() """Parametros para Pygame""" black = (0, 0, 0) white = (255, 255, 255) pygame.init() width = 850 height = 750 display = pygame.display.set_mode((width, height)) fpsClock = pygame.time.Clock() upperarm = ArmPart('upperarm.png', scale=.7) forearm = ArmPart('forearm.png', scale=.8) hand = ArmPart('hand.png', scale=1.0) origin = (width / 2, height / 2) m = 0 n = 0 """Funciones a utilizar""" def popupmsg(msg): popup = tk.Tk() popup.wm_title("!") label = ttk.Label(popup, text=msg) ttk.Label() label.pack(side="top", fill="x", pady=10) B1 = ttk.Button(popup, text="Okay", command = popup.destroy)
import pygame import pygame.locals from armpart import ArmPart black = (0, 0, 0) white = (255, 255, 255) pygame.init() width = 500 height = 500 display = pygame.display.set_mode((width, height)) fpsClock = pygame.time.Clock() upperarm = ArmPart('upperarm.png', scale=.7) base = (width / 2, height / 2) while 1: display.fill(white) ua_image, ua_rect = upperarm.rotate(.01) ua_rect.center += np.asarray(base) ua_rect.center -= np.array([np.cos(upperarm.rotation) * upperarm.offset, -np.sin(upperarm.rotation) * upperarm.offset]) display.blit(ua_image, ua_rect) pygame.draw.circle(display, black, base, 30)