Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
from tkinter import * # pip install qrcode import qrcode wnd = Tk() wnd.title("QR code generator") wnd.geometry("1000x550") wnd.config(bg="#AE2331") wnd.resizable(False, False) # създаване на иконка пред "QR code generator" # някъде трябва да имаме файл icon.png image_icon=PhotoImage(file="icon.png") wnd.iconphoto(False, image_icon) def generate(): name = title.get() text = entry.get() qr = qrcode.make(text) qr.save("Qrcode/" + str(name) + ".png") # първо трябва да се създаде някъде папка с име Qrcode global Image Image = PhotoImage(file="Qrcode/" + str(name) + ".png") Image_view.config(image=Image) # използваме global понеже Image_view го има и извън ф-ята и ако няма global промените няма да се отразят на глобално ниво Image_view = Label(wnd, bg="#AE2331") Image_view.pack(padx=50, pady=10, side=RIGHT) Label(wnd, text="Title", fg="white", bg="#AE2331", font=15).place(x=50, y=170) # създава се поле, където се въвежда заглавието title=Entry(wnd, width=13, font="arial 15") # да проверя дали може да стане и на един ред така: title=Entry(wnd, width=13, font="arial 15").place(x=50, y=200) title.place(x=50, y=200) # създава се поле, където ще се въвежда линка, на който ще се генерира QR code entry=Entry(wnd, width=28, font="arial 15") entry.place(x=50, y=250) # създава се бутона Button(wnd, text="Create", width=20, height=2, bg="black", fg="white", command=generate).place(x=50, y=300) wnd.mainloop()
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)