Thank Hello everyone. It's getting hot lately, I'm also very hot. When it's hot like that, I'm making software that I don't understand, but I'd like to explain it this time as well as understanding such software.
The personal computer is a model called "dynabook R734" from Toshiba.
The specs aren't that high, but it's quite comfortable, and thanks to the SSD, it starts up very quickly.
I used to use Atom before, but when I changed it to VS Code, it was really easy to use.
mojigene.py
import jaconv #Load jaconv
import tkinter as tk #Read tkinter as tk
import pyperclip #Load pyperclip
import sys #Read sys
root = tk.Tk() #Create a window called root
root.title("Chong language encryption system") #Window title
root.geometry("700x200") #Window size
root.resizable(width=False, height=False) #Fixed window size
def btn_click(): #Dedicate your life function when you press the button
kekka.delete(0, tk.END) #Clean the contents of kekka
fukugen.delete(0, tk.END) #Clean the contents of fukugen
moji = txt.get() #To get the contents of txt is defined as moji
result = moji.encode("utf-8") #UTF to moji-Encoding to 8 is defined as result
henkan = result.decode("cp932", errors="ignore")
#Decoding the characters encoded from result to cp932 is defined as henkan
#At this time, even if an error occurs, it will be ignored.(errors="ignore")With the argument
#Here utf decoded by cp932-8 comes out
#I can not understand
fukugenhenkan = henkan.encode("cp932")
#Encoding the information coming out of henkan to cp932 is defined as fukugenhenkan
#Say goodbye to letters here
kekkafukugen = fukugenhenkan.decode("utf-8", errors="ignore")
#utf the information that came out from fukugenhenkan-Decode to 8 and define this as kekkafukugen
#This will bring up the visible characters converted by cp932
kekka.insert(0, henkan) #Substitute the resulting henkan in the kekka textbox
fukugen.insert(0, kekkafukugen) #Substitute the resulting kekka fukugen in the text box called fukugen
pyperclip.copy(henkan) #Copy the contents of henkan to the clipboard
def copyfukugen(): #A function that copies the contents of fukugen
fukugennaiyou = fukugen.get() #To get the contents of fukugen is defined as fukugennaiyou
pyperclip.copy(fukugennaiyou) #Copy the contents of fukugennaiyou to the clipboard
def fukugensuru():
fukugen.delete(0, tk.END)
fukugensurunari = kekka.get()
fukugensimasu = fukugensurunari.encode("cp932")
fukugen_dekimasita = fukugensimasu.decode("utf-8", errors="ignore")
fukugen.insert(0, fukugen_dekimasita)
def clearboxing(): #Function to clean the box
txt.delete(0, tk.END) #Delete the contents of the txt text box
kekka.delete(0, tk.END) #Delete the contents of the kekka textbox
fukugen.delete(0, tk.END) #Delete the contents of the text box called fukugen
def exityamete(): #Don't stop
sys.exit(0) #Exit the software
label = tk.Label(text="Mysterious language you want to create") #Label label
label.place(x=100, y=40) #label position
txt = tk.Entry(width=50) #label text box"txt"
txt.place(x=230, y=40) #Position of txt
label2 = tk.Label(text="The mysterious language that came out") #Label 2
label2.place(x=100, y=70) #Position of label2
kekka = tk.Entry(width=50) #label2 textbox"kekka"
kekka.place(x=230, y=70) #position of kekka
label3 = tk.Label(text="Restored mysterious language") #Label 3
label3.place(x=100, y=100) #Position of label3
fukugen = tk.Entry(width=50) #label3 textbox"fukguen"
fukugen.place(x=230, y=100) #location of fukugen
btn = tk.Button(root, text='Give your life', command=btn_click) #Button called btn
#Press btn_click is executed
btn.place(x=0, y=0) #Position of btn
fukugenbutton = tk.Button(root, text="Restore", command=fukugensuru)
fukugenbutton.place(x=0, y=40)
clearbox = tk.Button(root, text="Erase existence", command=clearboxing) #Button called clearbox
#Press to execute clear boxing
clearbox.place(x=97, y=0) #position of clearbox
exitbutton = tk.Button(root, text="Don't push", command=exityamete) #A button called exit button
#Press to run exityamete
exitbutton.place(x=0, y=160) #Exit button position
fukugencopy = tk.Button(root, text="Restore copy", command=copyfukugen) #Button called fukugencopy
#Press to run copyfukugen
fukugencopy.place(x=197, y=0) #Position of fukugencopy
lookeverytimes = tk.Label(root, text="Darkness to privacy without worrying about electromagnetic wave attacks")
lookeverytimes.place(x=230, y=150)
donotalive = tk.Label(root, text="All copyright belongs to King Chong") #Label donota live
donotalive.place(x=250, y=170) #Position of donota live
versions = tk.Label(root, text="ver 1.0.1") #Version notation
versions.place(x=630, y=170) #Position of versions
root.mainloop() #Infinite loop with tkinter, without this, buttons are not displayed even if the window is displayed
As you can see, ** it's just unilaterally running from top to bottom **. ~~ (I don't understand the text is my hobby) ~~ The definition name is so appropriate that I may not understand it myself, so I will make it more specific the next time I assemble ... Since it is written in the comment out how it works, there is no particular explanation, but if you write one, the tkinter button etc. will not be displayed unless there is ** root.mainloop () ** at the bottom .. If I remember this much, I feel like I don't need it anymore. 〆 Thanks to this, it is useful when garbled long sentences. Only I seem to be in demand for such a program. So, good night.
https://qiita.com/mocha_xx/items/07465240d4212d946148 https://qiita.com/CyberRex/items/90eb450310f1697d03e9 https://qiita.com/mocha_xx/items/07465240d4212d946148 Thank you very much!!!