Project

General

Profile

Código e Implementación » History » Version 16

« Previous - Version 16/41 (diff) - Next » - Current version
Cesar Jimenez, 10/13/2023 10:04 AM


ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤWikipedia


Grupo A:

Integrantes: Cristian Sánchez, Jean Pier Duran, Sergio Rabanal, Valentina Álvarez, César Jiménez
Nombre del Producto: Machine EV3 G
Modulo: Proyecto I
Docente: Humberto Urrutia
Fecha de Inicio: 2023-08-14
Fecha de Termino: 2023-11-30


ㅤㅤㅤㅤㅤㅤㅤÍndice:

ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤIntefaz Grafica


import tkinter as tk
from tkinter import ttk
from tkinter import *
from tkinter import messagebox
import socket
# from ev3dev2.motor import MediumMotor, LargeMotor, OUTPUT_A, OUTPUT_B, OUTPUT_D, MoveTank

def Shot():
    shot = 'SHOT'
    server.send(shot.encode('utf-8'))

def Movement():
    movement = 'MOVEMENT'
    server.send(movement.encode('utf-8'))

def Up():
    up = 'UP'
    server.send(up.encode('utf-8'))

def Down():
    down = 'DOWN'
    server.send(down.encode('utf-8'))

def Left():
    left = 'LEFT'
    server.send(left.encode('utf-8'))

def Right():
    right = 'RIGHT'
    server.send(right.encode('utf-8'))

def Power():
    #INSERTAR CAMBIOS / AJUSTES PROGRAMA PRINCIPAL
    print()

def Angle():
    #INSERTAR CAMBIOS / AJUSTE DE ANGULO ?
    print()

def conectar():
    global server
    server = socket.socket()
    puerto = 4999
    direccion = "192.168.47.61" 
    try: 
        server.connect((direccion,puerto))
        messagebox.showinfo("Conectado","Se ha establecido la conexion exitosamente")
    except socket.error:
        messagebox.showwarning("Desconectado","Ingrese la dirección correcta")
    server.close()

ventana = tk.Tk()
ventana.geometry("500x400") 
ventana.title("Machine EV3")
ventana.configure(bg="cadetblue")  
ventana.resizable(0,0)
#Variables

# Boton Arriba
boton_arriba = Button(text="UP", command=Up, background="lightblue").place(x=200, y=70, width=120, height=90)  

# Boton Abajo
boton_abajo = Button(text="DOWN", command=Down, background="lightblue").place(x=200, y=270, width=120, height=90)

# Boton Izquierda
boton_izq = Button(text="LEFT", command=Left, background="lightblue").place(x=50, y=170, width=120, height=90)

# Boton Derecha
boton_derech = Button(text="RIGHT", command=Right, background="lightblue").place(x=340, y=170, width=120, height=90)

# Boton Disparar
boton_disparar = Button(text="Shot", command=Shot, background="lightblue").place(x=385, y=345, width=100, height=50)

# Boton Power de 15%
boton_p15 = Button(text="Power 10%", command=Power, background="lightblue").place(x=10, y=20, width=110, height=30)

# Boton Power de 25%
boton_p25 = Button(text="Power 30%", command=Power, background="lightblue").place(x=135, y=20, width=110, height=30)

# Boton potenca de 40%(max)
boton_p40 = Button(text="Power 50%", command=Power, background="lightblue").place(x=260, y=20, width=110, height=30)

# Boton Power por tiempo
boton_pseg= Button(text="Power for second.",command=Power, background="lightblue").place(x=385, y=20, width=110, height=30)

# Boton ingreso ip

boton_conectar = Button(text="Conection at Robot",command= conectar,background="lightblue").place(x=10, y=365, width=130, height=30)

ventana.mainloop()

logoPRO.png (91.7 KB) Cesar Jimenez, 09/17/2023 12:15 AM