USE PYHTON PLEASE! 1. Finish the BizzaroGUI implementation. The…
Question Answered step-by-step USE PYHTON PLEASE! 1. Finish the BizzaroGUI implementation. The… USE PYHTON PLEASE! 1. Finish the BizzaroGUI implementation. The BizzaroGUI does three things: Has a text box you can enter a URL and retrieve the title of the web page. For testing purposes, you can use this website (Note, other websites may work, https: websites may throw security errors for your code) i http://neverssl.com Enter a folder name and retrieve the depthCount of the folder (recursive function provided for you.) Enter a question and have the Magic8Ball answer it for you (Magic8Ball class provided). You need to ‘shake’ the Magic8Ball each time a user enters a question and clear the Entry field. Enter a url and click “Get Title” button: Image transcription textBizzaroGUI 0 X Enter URL http://neverssl.comGet Title Enter Folder GetDepth Count AskQuestion Get Magic Answer The… Show more… Show more Image transcription textEnter a folder name and press’GetDepth Count ‘button. This exampletraverses the Test folder … Show more… Show moreImage transcription textBizzaro GUI X Enter URL: Get TitleEnter Folder: GetDepth Count AskQuestion: Will this help th… Show more… Show moreUSE THE FOLLOWING CODE TEMPLETE. import os def nestingCount(pathname): largest=0 for item in os.listdir(pathname): n = os.path.join(pathname, item) if os.path.isdir(n): depth = nestingCount(n) if depth > largest: largest = depth return 1+largestfrom html.parser import HTMLParserfrom urllib.parse import urljoinfrom urllib.request import urlopenclass TitleParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) pass def handle_starttag(self, tag, attrs): pass def handle_endtag(self, tag): pass def handle_data(self, data): pass def getTitle(self): passfrom random import randrangeclass Magic8Ball(object): def __init__(self, q=[]): ‘the constructor’ if len(q)==0: q.append(‘It is certain’) q.append(‘It is decidedly so’) q.append(‘Without a doubt’) q.append(‘Yes definitely’) q.append(‘You may rely on it’) q.append(‘As I see it, yes’) q.append(‘Most likely’) q.append(‘Outlook good’) q.append(‘Yes’) q.append(‘Signs point to yes’) q.append(‘Reply hazy try again’) q.append(‘Ask again later’) q.append(‘Better not tell you now’) q.append(‘Cannot predict now’) q.append(‘Concentrate and ask again’) q.append(“Don’t count on it”) q.append(‘My reply is no’) q.append(‘My sources say no’) q.append(‘Outlook not so good’) q.append(‘Very doubtful’) self.q = q self.current=randrange(0,len(self.q)) def shake(self): ‘get the next answer’ self.current=randrange(0,len(self.q)) def get(self): ‘get the current answer’ return self.q[self.current] def numAnswers(self): ‘get the number of answers in the ball’ return len(self.q) def __iter__(self): ‘get the iterator’ return iter(self.q) def __str__(self): ‘string representation’ return ‘I am a Magic 8 Ball with {} answers’.format(len(self.q))from tkinter import Button, Entry, Label,Tk,TOP,LEFT,RIGHT,ENDfrom tkinter.messagebox import showinfoclass BizzaroGUI(Tk): ‘Number guessing app’ def __init__(self,parent=None): ‘constructor’ Tk.__init__(self, parent) pass def getTitle(self): #I left the following line as hint. #content =urlopen(url).read().decode() pass def getFolderDepth(self): pass def getAnswer(self): pass def make_widgets(self): pass Computer Science Engineering & Technology Python Programming CSC 242 Share QuestionEmailCopy link Comments (0)


