Código de Python - Generador de códigos QR (nueva versión)

Imágen de perfil
Val: 712
Bronce
Ha aumentado 1 puesto en Python (en relación al último mes)
Gráfica de Python

Generador de códigos QR (nueva versión)gráfica de visualizaciones


Python

Publicado el 22 de Diciembre del 2020 por Antonio (75 códigos)
3.377 visualizaciones desde el 22 de Diciembre del 2020
El presente programa permite la generación de códigos (y microcódigos) QR pudiendo establecer el tamaño, versión (Que puede ser M1,M2,M3,M4 y de 1 a 40) y colores del QR (usando los botones "DARK" y "LIGHT"). Una vez establecidas las opciones, el código se creará usando el botón "CREATE CODE" que permitirá almacenarlo en formato "png", "txt", "svg" y "eps". El botón "DISPLAY CODE" mostrará el último QR (o micro QR) creado en formato "png". Con el botón "COPY TEXT" se puede seleccionar un texto y copiarlo como entrada. Finalmente el botón "CLEAR TEXT" borrará el texto introducido.

qrm

ejemplo:

qrm1

codee
PARA CUALQUIER DUDA U OBSERVACIÓN USEN LA SECCIÓN DE COMENTARIOS.

Requerimientos

Lenguaje: Python
Librerías y recursos: segno, os, tkinter, pyperclip, threading, opencv, time

1.2
estrellaestrellaestrellaestrellaestrella(4)

Publicado el 22 de Diciembre del 2020gráfica de visualizaciones de la versión: 1.2
3.378 visualizaciones desde el 22 de Diciembre del 2020
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import segno
import tkinter
import os
import pyperclip
import cv2
import time
import threading
from tkinter import *
from tkinter import messagebox, ttk, filedialog, colorchooser
import tkinter.scrolledtext as scrolledtext
 
lista = ['M1','M2','M3','M4']
 
class app():
    def __init__(self):
        self.ventana = Tk()
        self.ventana.title("QR CREATOR")
        self.ventana.configure(bg='light blue',width=740,height=315)
        self.size = IntVar()
        self.size.set(1)
        self.version = StringVar()
        self.version.set("1")
        self.new_file = ""
        self.SQblack = "#000000"
        self.SQwhite = "#ffffff"
 
        self.display=scrolledtext.ScrolledText(self.ventana,width=70,height=10,font=('Arial', 10))
        self.display.place(x=30,y=30)
        self.copy = Button(self.ventana,text="COPY TEXT",command=self.init_copy)
        self.copy.place(x=30,y=198)
        self.clear = Button(self.ventana,text="CLEAR TEXT",command=self.clear)
        self.clear.place(x=101,y=198)
        self.btnCreate = Button(self.ventana,text="CREATE CODE",bg="light green",width=15,command=self.create_qr)
        self.btnCreate.place(x=228,y=240)
        self.lblSiz = Label(self.ventana,text="SIZE:",bg="light blue")
        self.lblSiz.place(x=593,y=30)
        self.btnSiz = Entry(self.ventana,width=9,textvariable=self.size)
        self.btnSiz.place(x=630,y=30)
        self.etiCol = Label(self.ventana,text="COLORS:",bg="light blue")
        self.etiCol.place(x=573,y=117)
        self.btnDark = Button(self.ventana,text="DARK",width=8,command=self.darkpart_color)
        self.btnDark.place(x=573,y=137)
        self.lblCo1 = Label(bg="black",width=5)
        self.lblCo1.place(x=646,y=139)
        self.btnCo2 = Button(self.ventana,text="LIGHT",width=8,command=self.lightpart_color)
        self.btnCo2.place(x=573,y=165)
        self.lblCo2 = Label(self.ventana,bg="white",width=5)
        self.lblCo2.place(x=646,y=165)
        self.lblVer = Label(self.ventana,text="VERSION:",bg="light blue")
        self.lblVer.place(x=570,y=70)
        self.entryVer = Entry(self.ventana,width=9,textvariable=self.version)
        self.entryVer.place(x=630,y=70)
        self.btnView = Button(self.ventana,text="DISPLAY CODE",bg="gold2",width=15,command=self.view_code)
        self.btnView.place(x=575,y=240)
 
        self.ventana.mainloop()
 
    def create_qr(self):
        self.new_file = filedialog.asksaveasfilename(initialdir="/",title="SAVE",defaultextension=".png",filetypes=[('png files','*.png'),
                                               ('svg files','*.svg'),('eps files','*.eps'),('txt files','*.txt')])
        if self.new_file != "":
            name,self.ex = os.path.splitext(self.new_file)
            if self.version.get() not in lista and self.version.get().isdigit():
                ver = int(self.version.get())
                self.microcode = False
            else:
                ver = self.version.get()
                self.microcode = True
            try:
                if self.ex != ".txt":
                    qr = segno.make(self.display.get('1.0',END),version=ver,micro=self.microcode)
                    qr.save(self.new_file,scale=self.size.get(),dark=self.SQblack,light=self.SQwhite)
                else:
                    qr = segno.make(self.display.get('1.0',END),micro=self.microcode)
                    qr.save(self.new_file)
                messagebox.showinfo("TASK COMPLETED","Code created successfully")
            except Exception as e:
                messagebox.showwarning("ERROR",str(e))
 
    def clear(self):
        self.display.delete('1.0',END)
 
    def copy_text(self):
        self.display.delete('1.0',END)
        self.ultima_copia = pyperclip.paste().strip()
        while True:
            time.sleep(0.1)
            self.copia = pyperclip.paste().strip()
            if self.copia != self.ultima_copia:
                self.display.insert(END,self.copia)
                self.ultima_copia = self.copia
                break
 
    def darkpart_color(self):
        _,color = colorchooser.askcolor()
        if color is not None:
            self.SQblack = color
            self.lblCo1.configure(bg=color)
 
    def lightpart_color(self):
        _,color = colorchooser.askcolor()
        if color is not None:
            self.SQwhite = color
            self.lblCo2.configure(bg=color)
 
    def view_code(self):
        if self.new_file != "" and self.ex == ".png":
            try:
                code = cv2.imread(self.new_file)
                cv2.imshow(self.new_file.split('/')[-1],code)
            except Exception as e:
                messagebox.showwarning("ERROR",str(e))
        else:
            messagebox.showinfo("CAN NOT DISPLAY","Can not display the file.")
 
 
    def init_copy(self):
        messagebox.showinfo("COPYING","select text and copy")
        t = threading.Thread(target=self.copy_text)
        t.start()
 
if __name__=="__main__":
    app()



Comentarios sobre la versión: 1.2 (4)

Imágen de perfil
22 de Diciembre del 2020
estrellaestrellaestrellaestrellaestrella
que buena pinta tiene:)
Responder
Imágen de perfil
22 de Diciembre del 2020
estrellaestrellaestrellaestrellaestrella
Gracias :)
Responder
VILA CHAHUA
19 de Octubre del 2021
estrellaestrellaestrellaestrellaestrella
porque no compila?
Responder
8 de Abril del 2022
estrellaestrellaestrellaestrellaestrella
No ha dejado ningún comentario
Responder

Comentar la versión: 1.2

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s6790