Entradas

Mostrando entradas de abril, 2019

PROGRAMAS PROPIOS

Imagen
PROGRAMA 1 Este programa calcula el total a pagar por un banquete, teniendo como precio regular $65 por platillo, en caso de que el  número de personas sea mayor a 100 pero menor o igual a 200, el platillo se cobrará a $75, por otra parte, si el  número de personas mayor a 200, cada platillo costará $50. from Tkinter import * import tkMessageBox #VENTANA ventana = Tk() ventana.title( "Servicio de Banquetes" ) ventana.geometry( "450x450" ) ventana.config(bg= "black" ) #MARCO CON INFORMACION marco = Frame(ventana) marco.config(bg= "pink" ) marco.place(x= 55 , y= 50 ) marco.columnconfigure( 0 , weight= 1 ) marco.rowconfigure( 0 , weight= 1 ) #ETIQUETAS e1 = Label(ventana, text= "Banquetes 'Sol'" , font=( 'Charlotte' , 35 ),background= "black" , foreground= "light pink" ).place(x= 40 , y= 300 ) e2 = Label(marco, text= "Numero de personas:" ,font=( ...

17. Importación desde internet

Imagen
Este programa nos permite obtener y mostrar una imagen de la web, para poder mostrarla es necesario que tenga la extensión .gif import base64 try : # Python2 import Tkinter as tk from urllib2 import urlopen except ImportError: # Python3 import tkinter as tk from urllib.request import urlopen root = tk.Tk() root.title( "Mostrar imagen" ) # margenes w = 520 h = 300 x = 100 y = 100 # usar width x height + x_offset + y_offset (no spaces!) root.geometry( "%dx%d+%d+%d" % (w, h, x, y)) # cualquier imagen de la red image_url = "https://steamuserimages-a.akamaihd.net/ugc/951841726604632846/8C089397379FB798EA78ADCA9ABF74393E6F7ADC/" image_byt = urlopen(image_url).read() image_b64 = base64.encodestring(image_byt) photo = tk.PhotoImage(data=image_b64) # SE CREA UN CANVAS BLANCO cv = tk.Canvas(bg= 'white' ) cv.pack(side= 'top' , fill= 'both' , expand= ...

16. Encriptador

Imagen
El siguiente programa nos permite encriptar y desencriptar un mensaje # -*- coding: utf-8 -*- from Tkinter import * # Ventana ventana = Tk() ventana.geometry( "300x300+350+80" ) ventana.title( "Encriptador" ) ventana.resizable(width=False, height=False) ventana.config(bg= "pink" ) try : ventana.iconbitmap( "icono.ico" ) except : print ( "no hay icono disponible" ) # Clave numclave = 1 # Funciones. def boton1 (): # Cifrado Cesar TAM_MAX_CLAVE = 26 def obtenerModo (): modo = "e" return modo def obtenerMensaje (): mensaje = text.get( "0.0" , END) return mensaje def obtenerClave (): global numclave clave = numclave return clave def obtenerMensajeTraducido (modo, mensaje, clave): if modo[ 0 ] == 'd' : clave = -clave traducc...