import tkinter as tk
from tkinter import messagebox
import random
import time
import random
import smtplib
import time
from email.mime.multipart import MIMEMultipart
import time
from email.mime.base import MIMEBase
from email import encoders
import getpass
from email.mime.text import MIMEText
obsah_desifrovane_zpravy = ""
import datetime
def tlacitko_klik():
okno.destroy()
menu = tk.Tk()
menu.geometry("800x700")
#menu.configure(bg="light gray")
menu.title("HiddenLanguage")
label1 = tk.Label(menu,text="\n" +"Šifrovat či Dešifrovat?",font=("Arial",30,"bold"))
label1.pack()
label2 = tk.Label(menu,text="Chcete šifrovat nebo dešifrovat?",font=("Arial",15))
label2.pack()
def tlacitko_klik_sif():
#Přes tento kod se uloží hodnoty a spustí funkce Šifrování a email.
def ulozeni_hodnot_mail():
# Získáme text z textboxu (Text widgetu)
zprava_ke_skryti = textbox_obsah.get("1.0", "end-1c") # "1.0" označuje začátek a "end-1c" označuje konec textu
nazev_souboru_sifr = (str(textbot_nazev_souboru.get("1.0", "end-1c")) + ".txt")
odesilatel = textbot_odesilatel.get("1.0", "end-1c")
prijemce = textbot_prijemce.get("1.0", "end-1c")
heslo = textbot_odesilatel_heslo.get("1.0", "end-1c")
#List který slouží pro for i in range dole
with open("zprava_ke_skryti.txt","w") as file:
file.write(zprava_ke_skryti)
with open(nazev_souboru_sifr, "w") as file:
file.write(nazev_souboru_sifr)
with open("odesilatel.txt","w") as file:
file.write(odesilatel)
with open("prijemce.txt","w") as file:
file.write(prijemce)
with open("heslo.txt", "w") as file:
file.write(heslo)
# Tady získáváme informace ke každé informaci v podobě True False (jestli je pole prázdné nebo ne) Stačí aby bylo jedno a bude error
if not zprava_ke_skryti.strip() or not nazev_souboru_sifr.strip() or not odesilatel.strip() or not prijemce.strip() or not heslo.strip():
messagebox.showinfo("Upozornění", "Vyplňte všechna pole!")
if odesilatel.strip():
if not odesilatel[-10:] == "@gmail.com":
messagebox.showinfo("Upozornění", "Jediná možná adresa u odesílatele e-mailu je @gmail.com!")
Sifrovani(zprava_ke_skryti, nazev_souboru_sifr)
with open("sifrovani.txt", "r") as file:
sifrovany_text = file.read()
oznamena_sifra = tk.Label(sifrovani_okno, text=(
"Vaše skrytá zakodovaná šifra zní takto: " + str(sifrovany_text)),
font=("Arial", 15))
oznamena_sifra.place(x=150, y=650, width=600, height=100)
email(odesilatel, prijemce, heslo, nazev_souboru_sifr)
messagebox.showinfo("Upozornění", "Úspěšně odeslán email!")
program_bude_ukoncen = tk.Label(sifrovani_okno,
text="Toto okno bude do pár sekund zavřeno.Poté budete moci program použít znovu.")
program_bude_ukoncen.place(x=250, y=650, width=600, height=100)
time.sleep(5)
sifrovani_okno.destroy()
time.sleep(2)
Uvodni_menu()
#Vytvoření šifrovacího okna
sifrovani_okno = tk.Tk()
sifrovani_okno.geometry("1920x1080")
sifrovani_okno.title("Šifrování")
menu.destroy()
def zpet_do_menu():
time.sleep(2)
sifrovani_okno.destroy()
Uvodni_menu()
label1 = tk.Label(sifrovani_okno ,text="Šifrování", font=("Arial", 30))
label1.pack()
label2 = tk.Label(sifrovani_okno,text="Níže napište svoji zprávu, jenž chcete šifrovat.", font=("Arial", 15))
label2.pack()
textbox_obsah = tk.Text(sifrovani_okno, height=10,width=50, font=("Arial", 15))
textbox_obsah.pack(pady=20)
label3 = tk.Label(sifrovani_okno,padx=30, text="Zde napište název pro soubor, v němž bude uložen kod.", font=("Arial", 15))
label3.pack()
textbot_nazev_souboru = tk.Text(sifrovani_okno, height=1,width=30, font=("Arial", 15))
textbot_nazev_souboru.pack(pady=20)
#EMAIL
email_odesilatel_label = tk.Label(sifrovani_okno,padx=35, text="Zadejte váš email", font=("Arial", 15))
email_odesilatel_label.pack()
textbot_odesilatel = tk.Text(sifrovani_okno, height=1, width=30, font=("Arial", 15))
textbot_odesilatel.pack(pady=20)
email_prijemce_label = tk.Label(sifrovani_okno, padx=45, text="Zadejte email dané osoby", font=("Arial", 15))
email_prijemce_label.pack()
textbot_prijemce = tk.Text(sifrovani_okno, height=1, width=30, font=("Arial", 15))
textbot_prijemce.pack(pady=20)
email_odesilatel_label_heslo = tk.Label(sifrovani_okno, padx=50, text="Zadejte vaše heslo", font=("Arial", 15))
email_odesilatel_label_heslo.pack()
textbot_odesilatel_heslo = tk.Text(sifrovani_okno, height=1, width=30, font=("Arial", 15))
textbot_odesilatel_heslo.pack(pady=20)
kontrola = tk.Button(sifrovani_okno,text="Odeslat", command=ulozeni_hodnot_mail,font=("Arial",20),bg = "gray", fg = "black", activebackground = "blue",activeforeground="white")
kontrola.pack(pady=10)
poznamka = tk.Label(sifrovani_okno, text="Kod v souboru, jemuž dáváte název je takový kod bez mezer, který je důležitý při dešifrování." + "\n" +"Odesílatel musí mít emailovou adresu od Gmailu. Příjemce nemusí." + "\n" +"Heslo vámi zadané se nikam neukládá a za to vám ručím. Celý programovací kod je veřejně přístupný.", font=("Arial", 10))
poznamka.pack(pady=1)
# TADY je check button na to jestli chce aby měl email nápovědu na to jak šifrovat a dešifrovat
def on_checkbox_click():
if napoveda.get() == 1:
#print("Zaškrtnuto")
with open("napoveda_uzivatel","w") as file:
file.write("ano")
else:
#print("Odškrtnuto")
with open("napoveda_uzivatel","w") as file:
file.write("ne")
napoveda = tk.IntVar()
checkbox = tk.Checkbutton(sifrovani_okno, text="Chcete aby email obsahoval nápovědu k dešifrování a šifrování?",font=("Arial",12), variable=napoveda, command=on_checkbox_click)
checkbox.pack()
navraceni_do_menu = tk.Button(sifrovani_okno,text="Vrátit se do menu",command=zpet_do_menu,font=("Arial",12,"bold"),bg="blue",fg="white",activeforeground="black")
navraceni_do_menu.pack()
#Konfigurace mailu
def email(odesilatel,prijemce,password,nazev_souboru):
qw = getpass.getuser()
import datetime
# Získání aktuálního času
cas = datetime.datetime.now()
hodiny_cas = cas.strftime("%H:%M:%S")
formatovany_cas = cas.strftime("%Y-%m-%d %H:%M:%S")
sender_password = password
# Email configuration
sender_email = odesilatel
receiver_email = prijemce
subject = "Byla vám poslána záhadná zpráva"
with open(nazev_souboru,"r") as file:
nova_abeceda = file.read()
with open("napoveda_uzivatel","r") as file:
napoveda_ano_ne = file.read()
if napoveda_ano_ne == "ano":
html_message = f"""<p><span style="font-family: Arial, Helvetica, sans-serif;"><strong><span style="font-size: 36px; color: rgb(0, 0, 0); text-shadow: rgba(136, 136, 136, 0) 0px 0px 0px;">Byla vám odeslána záhadná zpráva</span></strong></span></p>
<p><span style="font-size: 26px;"><span style="font-family: Arial, Helvetica, sans-serif;"><strong>Co to má znamenat?</strong></span></span></p>
<p>
<font face="Arial, Helvetica, sans-serif"><span style="font-size: 18px;">Před několika vteřinami, přesněji v </span></font><strong style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">{hodiny_cas}</strong>
<font face="Arial, Helvetica, sans-serif"><span style="font-size: 18px;"> byla zaznamenána podivná aktivita na jakémsi programu s názvem </span></font><strong style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">HiddenLanguage</strong>
<font face="Arial, Helvetica, sans-serif"><span style="font-size: 18px;">. Jediná dohledatelná informace je, že uživatel se vyskytuje pod přezdívkou </span></font><strong style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">{qw}</strong>
<font face="Arial, Helvetica, sans-serif"><span style="font-size: 18px;">. Pokud víte co máte dělat, tak čiňte jak usoudíte. V příloze je zaslán kód, jenž se vám bude zajisté hodit v dalších akcích.</span></font>
</p>
<p style="text-align: left;"><br></p>
<p style="text-align: left;"><span style="font-size: 26px; font-family: Arial, Helvetica, sans-serif;"><strong>Zachycená zpráva ze serv</strong><strong>eru</strong></span></p>
<div><span style="font-family: Arial, Helvetica, sans-serif;"><strong><span style="font-size: 18px;">{sifrovany_text}</span></strong></span></div>
<p><span style="font-family: Arial, Helvetica, sans-serif;"><br></span></p>
<p style="text-align: left;"><strong style="font-weight: 700; color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 26px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Zachycený kód ze serv</strong><strong style="font-weight: 700; color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 26px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">eru</strong></p>
<p style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;"><strong>{nova_abeceda}</strong></span></p>
<p style="text-align: left;"><br></p>
<p><br></p>
<p><span style="font-family: Arial, Helvetica, sans-serif;"><br></span></p>
<p style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><strong>Tvůrce HiddenLanguage</strong><img src="https://myfiles.space/user_files/168855_15d4659979401e54/168855_custom_files/img1690038712.jpeg" alt="He know where you are" style="margin: 0 auto; display: block; width: 1100px;" width="1100" height="614"></span></p>
<p style="text-align: left;"><br></p>
<p style="text-align: center;"><br></p>
<p style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><strong>Doba odeslání: {formatovany_cas}</strong></span></p>
<p style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><strong>Soubor ke stažení: <a href="https://www.mediafire.com/file/blnje4ut0ped9pi/HiddenLanguage.exe/file" target="_blank" rel="noopener noreferrer">MediaFire Download</a><br></strong></span></p>
<div style="color: red;"><br></div>
"""
else:
html_message = f"""<p><span style="font-family: Arial, Helvetica, sans-serif;"><strong><span style="font-size: 36px; color: rgb(0, 0, 0); text-shadow: rgba(136, 136, 136, 0) 0px 0px 0px;">Byla vám odeslána záhadná zpráva</span></strong></span></p>
<p><span style="font-size: 26px;"><span style="font-family: Arial, Helvetica, sans-serif;"><strong>Co to má znamenat?</strong></span></span></p>
<p>
<font face="Arial, Helvetica, sans-serif"><span style="font-size: 18px;">Před několika vteřinami, přesněji v </span></font><strong style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">{hodiny_cas}</strong>
<font face="Arial, Helvetica, sans-serif"><span style="font-size: 18px;"> byla zaznamenána podivná aktivita na jakémsi programu s názvem </span></font><strong style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">HiddenLanguage</strong>
<font face="Arial, Helvetica, sans-serif"><span style="font-size: 18px;">. Jediná dohledatelná informace je, že uživatel se vyskytuje pod přezdívkou </span></font><strong style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">{qw}</strong>
<font face="Arial, Helvetica, sans-serif"><span style="font-size: 18px;">. Pokud víte co máte dělat, tak čiňte jak usoudíte. V příloze je zaslán kód, jenž se vám bude zajisté hodit v dalších akcích.</span></font>
</p>
<p style="text-align: left;"><br></p>
<p style="text-align: left;"><span style="font-size: 26px; font-family: Arial, Helvetica, sans-serif;"><strong>Zachycená zpráva ze serv</strong><strong>eru</strong></span></p>
<div><span style="font-family: Arial, Helvetica, sans-serif;"><strong><span style="font-size: 18px;">{sifrovany_text}</span></strong></span></div>
<p><span style="font-family: Arial, Helvetica, sans-serif;"><br></span></p>
<p style="text-align: left;"><strong style="font-weight: 700; color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 26px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Zachycený kód ze serv</strong><strong style="font-weight: 700; color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 26px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">eru</strong></p>
<p style="text-align: left;"><strong style="font-weight: 700; color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="font-size: 18px;">{nova_abeceda}</span></strong></p>
<p style="text-align: left;"><br></p>
<p style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 26px;"><strong>Co dále</strong></span></p>
<p style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">V příloze jsou dva soubory. Jeden z nich se vždy jmenuje sifrovani.txt a druhý je pojmenován podle autora.</span></p>
<p style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 19px;"><strong><span style="color: rgb(226, 80, 65);">Dešifrování</span></strong></span></p>
<ol>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Stáhněte tento soubor, který se nejmenuje šifrování, do složky Plocha - HiddenLanguage - Program.</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Spusťte program a zvolte druhou možnost = dešifrování. </li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Zadejte název textového souboru, jenž jste si před chvílí stáhnul. (Pozor, napište název bez .txt!)</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Vložte nečitelný kód, jenž vidíte nad sebou v části B. </li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Počkejte na výsledek</li>
</ol>
<p><b style="font-family: Arial, Helvetica, sans-serif; font-size: 16px;">V odeslaných zprávách by jste měli vidět váš odeslaný mail.</b></p>
<p><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 19px; color: rgb(41, 105, 176);"><strong>Šifrování</strong></span></span></p>
<ol>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Spusťte program.</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Zvolte první možnost.</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Zadejte text, který chcete šifrovat.</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Zadejte název pro uložení vašeho kódu. (např. tajemny_kod)</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Uvidíte zašifrovanou zprávu</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Vyberte zda-li chcete šifru poslat někomu na mail.</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Zadejte svůj e-mail. (Pouze a jedině Gmail funguje)</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Zadejte e-mail toho, kdož má mail obdržet.</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Zadejte své heslo. (heslo nikde neukládáme!)</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 18px;">Je hotovo!</li>
</ol>
<p><span style="font-family: Arial, Helvetica, sans-serif;"><br></span></p>
<p><br></p>
<p><br></p>
<p><span style="font-family: Arial, Helvetica, sans-serif;"><br></span></p>
<p style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><strong>Tvůrce HiddenLanguage</strong><img src="https://myfiles.space/user_files/168855_15d4659979401e54/168855_custom_files/img1690038712.jpeg" alt="He know where you are" style="margin: 0 auto; display: block; width: 1100px;" width="1100" height="614"></span></p>
<p style="text-align: left;"><br></p>
<p style="text-align: center;"><br></p>
<p style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><strong>Doba odeslání: {formatovany_cas}</strong></span></p>
<p style="text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><strong>Soubor ke stažení: <a href="https://www.mediafire.com/file/blnje4ut0ped9pi/HiddenLanguage.exe/file" target="_blank" rel="noopener noreferrer">MediaFire Download</a><br></strong></span></p>
<div style="color: red;"><br></div>
"""
# Vytvoření instance MIMEText pro HTML obsah
html_part = MIMEText(html_message, 'html')
# Vytvoření multipart zprávy
msg = MIMEMultipart()
msg['From'] = sender_email
msg['To'] = receiver_email
msg['Subject'] = subject
# Přidání HTML části do multipart zprávy
msg.attach(html_part)
# Přidání přílohy dm_heslo.txt
with open(nazev_souboru, 'rb') as file:
attachment = MIMEBase('application', 'octet-stream')
attachment.set_payload(file.read())
encoders.encode_base64(attachment)
attachment.add_header('Content-Disposition', 'attachment', filename=nazev_souboru)
msg.attach(attachment)
# Přidání přílohy screenshot.png
with open("sifrovani.txt", 'rb') as file:
attachment = MIMEBase('application', 'octet-stream')
attachment.set_payload(file.read())
encoders.encode_base64(attachment)
attachment.add_header('Content-Disposition', 'attachment', filename='sifrovani.txt')
msg.attach(attachment)
# Odeslání e-mailu
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(odesilatel, sender_password)
server.send_message(msg)
server.quit()
# Tady se dělá práce
def Sifrovani(zprava_ke_skryti,nazev_souboru):
abeceda = 'ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz123456789ěščřžýáíé'
nova_abeceda = ''.join(random.sample(abeceda, len(abeceda)))
# Uložení šifrace
with open(nazev_souboru, "w") as file:
file.write(nova_abeceda)
# Konec ukládání
prevodni_tabulka = str.maketrans(abeceda, nova_abeceda)
global sifrovany_text
sifrovany_text = zprava_ke_skryti.translate(prevodni_tabulka)
with open("sifrovani.txt", "w") as file:
file.write(sifrovany_text)
sifrovani_okno.mainloop()
def tlacitko_klik_desif():
desifrovani_okno = tk.Tk()
desifrovani_okno.geometry("1920x1080")
desifrovani_okno.title("Dešifrování")
menu.destroy()
nazev = tk.Label(desifrovani_okno ,text="Dešifrování", font=("Arial", 30,"bold"))
nazev.pack()
zasifr_text = tk.Label(desifrovani_okno, text="Níže napište zprávu, jenž chcete dešifrovat.", font=("Arial", 15))
zasifr_text.pack()
textbox_obsah = tk.Text(desifrovani_okno, height=10, width=50, font=("Arial", 15))
textbox_obsah.pack(pady=20)
textbox_kod_label = tk.Label(desifrovani_okno,text="Zadejte dešifrovací kod v příloze (ten bez mezer)",font=("Arial",13))
textbox_kod_label.pack(pady=5)
textbox_kod = tk.Text(desifrovani_okno,height=2, width=20,font=("Arial",15))
textbox_kod.pack()
def Redirect():
zasifrovany_text_textbox = textbox_obsah.get("1.0", "end-1c")
textbox_kod_obsah = textbox_kod.get("1.0", "end-1c")
Desifrovani(zasifrovany_text_textbox,textbox_kod_obsah)
tlacitko_desifrovani = tk.Button(desifrovani_okno,text="Dešifrovat zprávu",command=Redirect,height=1,width=15,font=("Arial",15),bg="blue",fg="white")
tlacitko_desifrovani.pack(pady=20)
output_label = tk.Label(desifrovani_okno,text="Obsah dešifrované zprávy",font=("Arial",15))
output_label.pack(pady=5)
output = tk.Text(desifrovani_okno,height=10,width=50,font=("Arial",15))
output.pack()
def Desifrovani(zasifrovany_text,zasifrovany_kod):
sifrovana_abeceda = zasifrovany_kod
def create_decryption_map(original_alphabet, shuffled_alphabet):
decryption_map = {}
for orig_char, shuffled_char in zip(original_alphabet, shuffled_alphabet):
decryption_map[shuffled_char] = orig_char
return decryption_map
# Příklad použití:
original_alphabet = 'ABDCEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz123456789ěščřžýáíé#@!§'
shuffled_alphabet = sifrovana_abeceda
decryption_map = create_decryption_map(original_alphabet, shuffled_alphabet)
# Dešifrování zprávy
encrypted_message = zasifrovany_text
decrypted_message = "".join(decryption_map.get(char, char) for char in encrypted_message)
obsah_desifrovane_zpravy = decrypted_message
output.delete("1.0", "end") # Vymažeme obsah textového pole
output.insert("1.0", obsah_desifrovane_zpravy) # Vložíme dešifrovanou zprávu do textového pole
#Tady budou věci po checkboxech
desifrovani_okno.mainloop()
def navraceni_do_menu():
menu.destroy()
Uvodni_menu()
prostor_button = tk.Frame(menu)
prostor_button.columnconfigure(0,weight=10)
prostor_button.columnconfigure(1,weight=10)
prostor_button.columnconfigure(2,weight=10)
tlacitko_sif = tk.Button(prostor_button,text="Šifrovat", command=tlacitko_klik_sif,font=("Arial",15,"bold"),width=50,height=4,bg="red", fg="white",activebackground="orange",activeforeground="black")
tlacitko_sif.grid(row=0,column=0,sticky=tk.W+tk.E)
tlacitko_desif = tk.Button(prostor_button,text="Dešifrovat", command=tlacitko_klik_desif,font=("Arial",15,"bold"),width=50,height=4,bg="green", fg="white",activebackground="yellow",activeforeground="black")
tlacitko_desif.grid(row=1,column=0,sticky=tk.W+tk.E)
tlacitko_menu = tk.Button(prostor_button, text="Zpět do menu", command=navraceni_do_menu, font=("Arial", 15, "bold"),width=50,height=4,
bg="purple", fg="white", activebackground="pink",
activeforeground="black")
tlacitko_menu.grid(row=2,column=0,sticky=tk.W+tk.E)
prostor_button.pack(pady=100)
#(x=600, y=100, width=100, height=100)
menu.mainloop()
def Uvodni_menu():
# Vytvoření okna
global okno
okno = tk.Tk()
okno.geometry("800x500")
okno.title("HiddenLanguage")
# widget s časem
def update_time():
current_time = time.strftime("%d.%m.%Y %H:%M:%S") # Formát času (hodiny:minuty:sekundy)
time_label.config(text=current_time)
okno.after(1000, update_time) # Znovu spustit funkci každou sekundu (1000 ms)
# Vytvoření tlačítka
nazev = tk.Label(okno, text="\n" + "HiddenLanguage", font=("Arial", 30, "bold"))
nazev.pack()
informace = tk.Label(okno,
text="Tento program umí šifrovat a dešifrovat zprávy." + "\n" + "Zašifrované zprávy může odeslat jakékoliv určené osobě na mail." + "\n" + "Více informací naleznete na kubasobr.blogspot.com" + "\n" + "Original HiddenLanguage, all rights reserved",
font=("Arial", 12))
informace.pack()
tlacitko = tk.Button(okno, text="Klikněte pro start!", command=tlacitko_klik, font=("Arial", 25, "bold"), height=5,
width=24, bg="blue", fg="white", activebackground="aqua", activeforeground="black")
tlacitko.pack(padx=50, pady=20)
#WiDGET S AKTUÁLNÍM ČASEM CO SE AKTUALIZUJE PO 1s
time_label = tk.Label(okno, font=("Helvetica", 24), bg="light gray")
time_label.pack(fill=tk.BOTH, expand=True)
update_time()
# Spuštění smyčky událostí (main loop)
okno.mainloop()
def Prihlaseni():
def update_time():
current_time = time.strftime("%d.%m.%Y %H:%M:%S") # Formát času (hodiny:minuty:sekundy)
time_label.config(text=current_time)
prihlaseni.after(1000, update_time) # Znovu spustit funkci každou sekundu (1000 ms)
prihlaseni = tk.Tk()
prihlaseni.geometry("800x700")
prihlaseni.title("HiddenLanguage")
def tlacitko_klik():
heslo = entry_password.get() # Získání zadaného hesla
if heslo == "kubasobr4": # Nahraďte "SECRET_PASSWORD" vaším tajným heslem
label_error.config(text="Zadali jste správné heslo.",font=("Arial",10),fg="blue")
prihlaseni.destroy()
# ... Pokračování s vaším kódem ...
else:
label_error.config(text="Neplatné heslo, zkuste to znovu.") # Nastavení chybového textu
entry_password.delete(0, tk.END) # Vymazání pole pro zadání hesla
def tlacitko_stisk_klavesy(event):
tlacitko_klik()
# Zobrazení výzvy pro vstup hesla
label = tk.Label(prihlaseni, text="Vítejte v aplikaci HiddenLanguage", font=("Arial", 30, "bold"))
label.pack(pady=50)
label_password = tk.Label(prihlaseni, text="Zadejte heslo:", font=("Arial", 20))
label_password.pack()
entry_password = tk.Entry(prihlaseni, font=("Arial", 20), show="*")
entry_password.pack(pady=20)
button = tk.Button(prihlaseni, text="Potvrdit", font=("Arial", 20), command=tlacitko_klik)
button.pack(pady=30)
label_error = tk.Label(prihlaseni, text="", font=("Arial", 15), fg="red")
label_error.pack()
entry_password.bind("<Return>", tlacitko_stisk_klavesy)
time_label = tk.Label(prihlaseni, font=("Helvetica", 24), bg="light gray")
time_label.pack(fill=tk.BOTH, expand=True)
update_time()
prihlaseni.mainloop()
Uvodni_menu()
Prihlaseni()
Uvodni_menu()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter