Question: PYTHON 3.6 Hello I'm trying to use a gui to allow a user to type a string into the following gui and render the results

PYTHON 3.6

Hello I'm trying to use a gui to allow a user to type a string into the following gui and render the results of morse code program.

I will attach what I have which includes source code for a gui, and my morse code program. I simply need help in putting the two together so that the string entered will be rendered from my morse code program.

MY GUI THUS FAR....

# !/usr/bin/python3 from tkinter import *

top = Tk() L1 = Label(top, text = "Enter String") L1.pack( side = LEFT) E1 = Entry(top, bd = 15) E1.pack(side = RIGHT)

top.mainloop()

THEN HERE IS MY MORSE CODE PROGRAM....

num_list = ['-----' , '----', '..---' , '...--' , '....-' , '....' , '..' , '.----' , '-.-' , '.-..' , '--' , '-.' , '---' , '.--.', '--.' , '.-.' , '...' , '-' , '..-' , '...-' , '.--' , '-..-' , '-.-' , '--..'] num_alpha =['.-' , '-...' , '-.-.' , '-..' , '.' , '..-.' , '--.' , '....' , '..' , '.---' , '-.-' , '.-..' , '--' , '-.' , '---' , '.--.' , '--.-' , '.-.' , '...' , '-' , '..-' , '...-' , '.--' , '-..-' , '-.--' , '--..']

strin = input("Enter a string: ") mor_str='' for ch in strin: if ch=='': mor_str+=''; elif ch==',': mor_str+='--..--' elif ch =='?': mor_str+='..--..' elif ch.isdigit(): mor_str+=num_list[int(ch)] elif ch.isalpha(): mor_str+=num_alpha[int(ord(ch.upper()))-65] else: mor_str+=ch print ('Morse code of the given string is: ' , mor_str)

Can you help me put these two together. If not clear, I simpy want the gui to render the correct morse translation of user inputed string and prompt the correct translation on the same gui. Also a way to continue this functionality until 'tk' is closed. Feel free to name my two programs as you prefer. Thank you. Please if this is not clear comments will later help.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!