Make a very simple conventer program(GUI) with python and Tkinter

in python •  7 years ago 

HI friends, we meet again...tonight i wanna show you how to make simple converter from ASSCI To Hexadecimal or vice versa

ok. let's get stated...

first and foremost, import Tkinter

from Tkinter import *

And then we create some variables to this program

master        = Tk()
u_input       = StringVar()
output        = StringVar()

The Main program is here :

def asscitohex():
    ok = u_input.get()
    ok2 = ok.encode('hex')
    output.set(ok2)

def hextoassci():
    ok = u_input.get()
    ok2 = ok.strip().decode('hex')
    output.set(ok2)

it's The GUI program

Label(master, text='CONVERTER').pack()
Entry(master, textvariable=u_input, justify=CENTER).pack()
Label(master, textvariable=output, bg='white', width=20).pack()
Button(master, text="Assci to Hex", command=asscitohex).pack(side=LEFT)
Button(master, text="Hex to Assci", command=hextoassci).pack(side=LEFT)

don't forget to add mainloop function in the end to make it run
And then run it as usual

Here is the complete program

from Tkinter import *


master        = Tk()
u_input       = StringVar()
output        = StringVar()

def asscitohex():
    ok = u_input.get()
    ok2 = ok.encode('hex')
    output.set(ok2)

def hextoassci():
    ok = u_input.get()
    ok2 = ok.strip().decode('hex')
    output.set(ok2)

Label(master, text='CONVERTER').pack()
Entry(master, textvariable=u_input, justify=CENTER).pack()
Label(master, textvariable=output, bg='white', width=20).pack()
Button(master, text="Assci to Hex", command=asscitohex).pack(side=LEFT)
Button(master, text="Hex to Assci", command=hextoassci).pack(side=LEFT)


Make a very simple conventer program(GUI) with python and Tkinter

mainloop()

```
That's all..

#If you have any Question, feel free to Ask ... ^_^
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @amjaed! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - The results, the winners and the prizes

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @amjaed! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!