Not Getting The desired output on my system - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Not Getting The desired output on my system (/thread-2669.html) Pages:
1
2
|
Not Getting The desired output on my system - Rashi - Apr-01-2017 from tkinter import * import random class ExamGuru: def _init_(self, parent): self.parent=parent self.index=0 self.question_num=1 self.score=0 self.questions=[Question("First Insurance Company In India ? ", "Oreintal Life Insurance",["Bombay Mutual Insurance","Western India Insurance","LIC"]), Question("Which Of The Following Risks Are Insurable ?", "Financial Risk",["Non Financial","Both","None"])] self.mainquestionframe= Frame(parent, bg="orange", width=800, height=500) self.mainquestionframe.pack_propagate(0) self.mainquestionframe.pack(pady=5) self.headingframe= Frame(self.mainquestionframe, bg="blue",Width=800, height=40) self.headingframe.pack_propagate() self.headingframe.pack(pady=5) class Question: def _init_(self,question,answer,dummies): self.question=question self.answer=answer self.dummies=dummies self.set_answers() def set_answers(self): self.answers=self.dummies self.answer.insert(random.randrange(len(self.dummies)+1), self.answer) if __name__=='__main__': root=Tk() root.title("Exam Guru") root.mainloop()not getting any anything on the tkinter window system- ubuntu 14.04 python version - 3.4.3 RE: Not Getting The desired output on my system - Larz60+ - Apr-01-2017 You haven't instantiated any classes, so the only code that's going to execute is the code in your if __name__ ... clause This probably means the window will be incredably small, and your probably just not seeing it. try adding this line after your title command: root.geometry('200x200+10+10')That will give you more surface area to look at. RE: Not Getting The desired output on my system - Rashi - Apr-03-2017 (Apr-01-2017, 03:27 PM)Larz60+ Wrote: You haven't instantiated any classes, so the only code that's going to execute is the code in your if __name__ ... clause nope its not working either yes the tkinter window is small but its not so small that it cannot be seen nothing is in there expect for the title of the window RE: Not Getting The desired output on my system - wavic - Apr-03-2017 I don't know Tkinter at all but you don't use ExamGuru anywhere. if __name__=='__main__': root=Tk() root.title("Exam Guru") app = ExamGuru(master=root) app.mainloop()Ref.: https://docs.python.org/3.5/library/tkinter.html#a-simple-hello-world-program RE: Not Getting The desired output on my system - Larz60+ - Apr-03-2017 The instructions I gave you are valid. Lat me have a look' try: from tkinter import * import random class ExamGuru: def _init_(self, parent, title='None', geometry='100x100+10+10'): self.parent=parent self.parent.geometry(geometry) self.title(title) self.index=0 self.question_num=1 self.score=0 self.questions=[Question("First Insurance Company In India ? ", "Oreintal Life Insurance",["Bombay Mutual Insurance","Western India Insurance","LIC"]), Question("Which Of The Following Risks Are Insurable ?", "Financial Risk",["Non Financial","Both","None"])] self.mainquestionframe= Frame(parent, bg="orange", width=800, height=500) self.mainquestionframe.pack_propagate(0) self.mainquestionframe.pack(pady=5) self.headingframe= Frame(self.mainquestionframe, bg="blue",Width=800, height=40) self.headingframe.pack_propagate() self.headingframe.pack(pady=5) class Question: def _init_(self,question,answer,dummies): self.question=question self.answer=answer self.dummies=dummies self.set_answers() def set_answers(self): self.answers=self.dummies self.answer.insert(random.randrange(len(self.dummies)+1), self.answer) if __name__=='__main__': root=Tk() ExamGuru(parent=root, title="Exam Guru", geometry='600x400+10+10') root.mainloop() RE: Not Getting The desired output on my system - Rashi - Apr-08-2017 (Apr-03-2017, 06:35 PM)Larz60+ Wrote: The instructions I gave you are valid. RE: Not Getting The desired output on my system - Larz60+ - Apr-08-2017 Please post all traceback code. If you are not getting an error, it wouldn't hurt to add some print statements here and there to see where faililg RE: Not Getting The desired output on my system - Rashi - Apr-12-2017 (Apr-08-2017, 09:29 PM)Larz60+ Wrote: Please post all traceback code. nevermind i ditched that code and starting working with a new one it was getting complex every minute for me RE: Not Getting The desired output on my system - Larz60+ - Apr-12-2017 Quote:it was getting complex every minute for meCode has a way of doing that. Keep your methods and functions simple, so only one thing in each RE: Not Getting The desired output on my system - Rashi - Apr-12-2017 (Apr-12-2017, 12:01 PM)Larz60+ Wrote:well i tried to keep it as much simple as i can but now i m stuck while making a function to make it run properly can u help me out ?Quote:it was getting complex every minute for meCode has a way of doing that. Keep your methods and functions simple, |