Answered step by step
Verified Expert Solution
Question
1 Approved Answer
My BButton = Do Another does not work and neither does my CButton= Quit. I need my Do Another button to clear the entry box
My BButton = Do Another does not work and neither does my CButton= Quit. I need my Do Another button to clear the entry box and allow another sentence to be input and translated by repeating the code above it. How do I loop this around? What am I doing wrong?
rom button import def main ): win Graphwin ("Duck Latin", 600, 600) win.setCoords (0,0,100,100) Pointl-Point (50, 90) # Heading headtext= Text (Point!, "This Program Translates English into Duck Latin") headtext.draw (win) #EntryBox entrybox1= Entry ( Point (50, 70),60) entryboxl.setFill("white") entryboxl.draw (win) #Prompt promptl- Text (Point (50,80), "Enter A Sentence") promptl.draw (win) #Button Setup AButton= Button (win, Point (20,30), 20,5, "Quack") BButton - Button (win, Point (50,30), 20,5, "Do Another") CButton - Button (win, Point (80,30), 20, 5, "Quit" AButton.activate () BButton.activate () CButton.activate () pwin.getMouse #Letter Index vowel ['a','i', 'e', 'o', 'u', 'A', 'E','1","O', 'U' consonant = ['b', 'c', 'd', 'f','g','h','j', 'k', '1', ' ,m', 'n','p', 'g", 'r','s", #Loop Structure while not CButton.clicked (p): if AButton.clicked (p) sentencel -entryboxl.getText () words-sentencel.split () news tring= "" for word in words: if word [0] in vowel: strl -word "wack" strl- "".join (strl) news t ring = news tring + " "+ str1 elif word [o] in consonant: rom button import def main ): win Graphwin ("Duck Latin", 600, 600) win.setCoords (0,0,100,100) Pointl-Point (50, 90) # Heading headtext= Text (Point!, "This Program Translates English into Duck Latin") headtext.draw (win) #EntryBox entrybox1= Entry ( Point (50, 70),60) entryboxl.setFill("white") entryboxl.draw (win) #Prompt promptl- Text (Point (50,80), "Enter A Sentence") promptl.draw (win) #Button Setup AButton= Button (win, Point (20,30), 20,5, "Quack") BButton - Button (win, Point (50,30), 20,5, "Do Another") CButton - Button (win, Point (80,30), 20, 5, "Quit" AButton.activate () BButton.activate () CButton.activate () pwin.getMouse #Letter Index vowel ['a','i', 'e', 'o', 'u', 'A', 'E','1","O', 'U' consonant = ['b', 'c', 'd', 'f','g','h','j', 'k', '1', ' ,m', 'n','p', 'g", 'r','s", #Loop Structure while not CButton.clicked (p): if AButton.clicked (p) sentencel -entryboxl.getText () words-sentencel.split () news tring= "" for word in words: if word [0] in vowel: strl -word "wack" strl- "".join (strl) news t ring = news tring + " "+ str1 elif word [o] in consonantStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started