elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Tutorial básico de Quickjs


  Mostrar Mensajes
Páginas: [1] 2
1  Programación / Scripting / Re: Mi tercer progrma en Tkinter, error! en: 11 Febrero 2019, 16:14 pm
Código
  1. from tkinter import Tk,Label,Button,Frame
  2.  
  3. proceso=0
  4.  
  5. def iniciar(contador=0):
  6.    global proceso
  7.  
  8.  
  9.    time['text'] = contador
  10.  
  11.  
  12.    proceso=time.after(1000, iniciar, (contador+1))
  13.  
  14. def parar():
  15.    global proceso
  16.    time.after_cancel(proceso)
  17.  
  18. root = Tk()
  19. root.title('Cronometro')
  20.  
  21. time = Label(root, fg='red', width=20, font=("","18"))
  22. time.pack()
  23.  
  24.  
  25. frame=Frame(root)
  26. btnIniciar=Button(frame, fg='blue', text='Iniciar', command=iniciar)
  27. btnIniciar.grid(row=1, column=1)
  28. btnParar=Button(frame, fg='blue', text='Parar', command=parar)
  29. btnParar.grid(row=1, column=2)
  30. frame.pack()
  31.  
  32. root.mainloop()

A mi este código me funciona. Debería ser igual. Escribe todo tu código de esta manera, donde dice aquí y quita los espacios.

[  code=python  ]  Aqui  [  /code ]


Lo probe quitando los espacios i me saldo error en la linia 3, me estado peleando un rato con la composicon i no hay manera
2  Programación / Scripting / Re: Mi tercer progrma en Tkinter, error! en: 9 Febrero 2019, 15:46 pm
Funciona lo que me dices, pero  ahora me sale error mas abajo debe ser otra cosa.

Traceback (most recent call last):
  File "C:\Users\xiqui\Desktop\python\xiqui2\cronometro.py", line 40, in <module>
    btnParar=Button(frame, fg='blue', text='Parar', command=parar)
NameError: name 'parar' is not defined




https://likegeeks.com/es/ejemplos-de-la-gui-de-python/
3  Programación / Scripting / Re: Mi primer ejercicio con Tkinter en: 9 Febrero 2019, 15:45 pm
Garcias, entre tu explicaicon i lo que e ido provando e consido fijarlo a mis necessidades

https://likegeeks.com/es/ejemplos-de-la-gui-de-python/

Estoy aprendiendo cada mes esto de Tkinter aqui os ajunto mi nueva creacion:

https://jordixicarspython.wordpress.com/2019/02/09/ejercicio-6-pestanas-con-los-meses/


MOD: No hacer triple post. Usa el botón modificar.
4  Programación / Scripting / Mi tercer progrma en Tkinter, error! en: 9 Febrero 2019, 12:28 pm
https://www.lawebdelprogramador.com/codigo/Python/4752-Simple-cronometro-con-TK.html

from tkinter import Tk,Label,Button,Frame

proceso=0

def iniciar(contador=0):

    global proceso

    time['text'] = contador

 
    proceso=time.after(1000, iniciar, (contador+1))

 

def parar():

    global proceso
        
        time.after_cancel(proceso)

 
root = Tk()

root.title('Cronometro')


time = Label(root, fg='red', width=20, font=("","18"))

time.pack()


frame=Frame(root)

btnIniciar=Button(frame, fg='blue', text='Iniciar', command=iniciar)

btnIniciar.grid(row=1, column=1)

btnParar=Button(frame, fg='blue', text='Parar', command=parar)

btnParar.grid(row=1, column=2)

frame.pack()


root.mainloop()
5  Programación / Scripting / Mi primer ejercicio con Tkinter en: 8 Febrero 2019, 20:03 pm
Emepze con Tkinter i aproveche un script de dar informacion i con un boton de salida, pero mi texto es demasiado grande para el tamaño i no consigo ver como hacer mas grande la ventana sin interferir a los botones. Alguien sabria como verlo mas grande.


https://jordixicarspython.wordpress.com/2019/02/08/prueba-con-tkinter/
6  Programación / Scripting / Re: Calculadora en Python con Tkinter! (v1.2) en: 8 Febrero 2019, 18:43 pm
Gracias, voy a probar de instalar Tkinter i realizar el ejercicio

7  Programación / Scripting / Validar ejercicio2 mediante el ejercicio 1 en: 8 Febrero 2019, 15:42 pm
Quiero entar los datos del erjercio 1 i que me rederrecione al ejercico 2 una vez los datos sean correctos. Soy inesperto en pyhton asi que si alguein sabe de algun comando que me contese al mensaje

https://jordixicarspython.files.wordpress.com/2019/02/programilla-1.png?w=680

https://jordixicarspython.files.wordpress.com/2019/02/mesmenu.png
8  Programación / Scripting / Re: Ejericio 2 python: Menu desplegable, cual es el numero del mes en: 8 Febrero 2019, 14:39 pm
https://jordixicarspython.files.wordpress.com/2019/02/mesmenu.png
9  Programación / Scripting / Ejericio 2 python: Menu, cual es el numero del mes en: 8 Febrero 2019, 14:33 pm
Esto es un programa donde podemos ver el numero de mes.

def pedirNumeroEntero():
 
    correcto=False
    num=0
    while(not correcto):
        try:
            num = int(input("Introduce el numero de mes: "))
            correcto=True
        except ValueError:
            print('Error, introduce un numero entero')
    
    return num
 
salir = False
opcion = 0
 
while not salir:
 
    print ("\n1. Enero")
    print ("2. Febrero")
    print ("3. Marzo")
    print ("4. Abril")
    print ("5. Mayo")
    print ("6. Junio")
    print ("7. Julio")
    print ("8. Agosto")
    print ("9. Septiemnbre")
    print ("10. Octubre")
    print ("11. Noviembre")
    print ("12. Diciembre")
    print ("13. Salir")
    print ("\nElige una opcion")
 
    opcion = pedirNumeroEntero()
 
    if opcion == 1:
        print ("\n*********Enero*********")
    elif opcion == 2:
        print ("\n*********Febrero*********")
    elif opcion == 3:
        print("\n*********Marzo*********")
    elif opcion == 4:
        print ("\n*********Abril*********")
    elif opcion == 5:
        print ("\n*********Mayo*********")
    elif opcion == 6:
        print("\n*********Junio*********")
    elif opcion == 7:
        print ("\n*********Julio*********")
    elif opcion == 8:
        print("\n*********Agosto*********")
    elif opcion == 9:  
            print ("\n*********Septiembre*********")
    elif opcion == 10:
        print("\n*********Ocutbre*********")
    elif opcion == 11:  
            print ("\n*********Noviembre*********")
    elif opcion == 12:
            print("\n*********Diciembre*********")
    elif opcion == 13:
        salir = True
    else:
        print ("Introduce un numero entre 1 y 12")
 
print ("Fin")
10  Programación / Scripting / Re: Ejericio python 1: Ejericio python 1 en: 8 Febrero 2019, 14:32 pm
https://jordixicarspython.files.wordpress.com/2019/02/programilla-1.png?w=680
Páginas: [1] 2
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines