Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-24 Thread Matthew Polack
Thanks Alan and Peter for all your help with this. I got it all to work..thank you.. like learning a musical instrument...probably just need some time consolidating the current skill set...has been a lot to take in... but getting there steadily...and bit by bit it is starting to make sense..

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-23 Thread Peter Otten
Matthew Polack wrote: > I'm also trying to solve the rounding issue...but can't work out the > syntax using the example provided...have tried this but I get an error... > > _tkinter.TclError: unknown option "-text %.2f" > > .I'm sure it is a simple syntax issue...but I don't know what it is. >

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-23 Thread Peter Otten
Matthew Polack wrote: > I'm working my way through some of the tips you provided and tried to use > the code givenbut am getting an error at Line 75 in my code re: not > enough arguments for format string > > _ > return self.func(*args) > File "Timespicture.py", line 75, in

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-23 Thread Alan Gauld via Tutor
On 23/08/18 05:47, Matthew Polack wrote: > Hi Alan, > > I'm working my way through some of the tips you provided and tried to use > the code givenbut am getting an error at Line 75 in my code re: not > enough arguments for format string > > _ > return self.func(*args) > File

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-23 Thread Matthew Polack
Hi Alan, I'm also trying to solve the rounding issue...but can't work out the syntax using the example provided...have tried this but I get an error... _tkinter.TclError: unknown option "-text %.2f" .I'm sure it is a simple syntax issue...but I don't know what it is. def viewPercent():

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-23 Thread Matthew Polack
Hi Alan, I'm working my way through some of the tips you provided and tried to use the code givenbut am getting an error at Line 75 in my code re: not enough arguments for format string _ return self.func(*args) File "Timespicture.py", line 75, in checkanswer Your current score

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-17 Thread Alan Gauld via Tutor
On 17/08/18 03:19, Matthew Polack wrote: > def viewPercent(): > percentCalc = score/total*100 > rounded = round(percentCalc, 2) > percentViewLab["text"] = rounded Since you only want the rounded value for display this is usually achieved using string formatting: >>> s = "Here is a

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-17 Thread Alan Gauld via Tutor
On 17/08/18 03:19, Matthew Polack wrote: > 1.) Centre feature > > When I use txt.insert I need to use the feature Peter found... > > center = txt.tag_config("center", justify="center") > txt.insert(0.0, result, "center") > > but in the Enter label section...I could just use it straight

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-17 Thread Matthew Polack
Thanks Alan and Peter, I've gone through and made a bunch of changes based on all your advice. Thank you...everything seems to be fully working and I think I have made the code more efficient using your advice...hope I got everything. (full code below) I've just added an example menu to

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-16 Thread Alan Gauld via Tutor
On 16/08/18 08:18, Matthew Polack wrote: > The last remaining issue is the program does not calculate the percentage > right when you make mistakes...it just keeps giving a result of 100%. > def percentCheck(): > global percentScore > global score > global mistakes > global total

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-16 Thread Peter Otten
Matthew Polack wrote: > Hi All, > > Thanks to your help I've nearly got my demo 'Times Tables' program fully > working. > > The last remaining issue is the program does not calculate the percentage > right when you make mistakes...it just keeps giving a result of 100%. > > I've looked and head

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-16 Thread Matthew Polack
Hi All, Thanks to your help I've nearly got my demo 'Times Tables' program fully working. The last remaining issue is the program does not calculate the percentage right when you make mistakes...it just keeps giving a result of 100%. I've looked and head scratched...and am not sure. Can anyone

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-15 Thread Matthew Polack
Thanks Alan and Peter, Really appreciate your replies. Will try this out tomorrow and see if I can get it to work. I keep googling things myself...but with my 'beginner' status sometimes struggle to understand the solutions out therebut in tiny steps am making progress! Certainly know a lot

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-15 Thread Alan Gauld via Tutor
On 15/08/18 10:18, Peter Otten wrote: > Matthew Polack wrote: > >> *Question 2:* >> Is there a way to centre text within the text frame? I can change the font >> and size...but don't know how to centre it? > > Ok, I wanted to know it myself, and found > >

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-15 Thread Peter Otten
Matthew Polack wrote: > *Question 2:* > Is there a way to centre text within the text frame? I can change the font > and size...but don't know how to centre it? Ok, I wanted to know it myself, and found https://stackoverflow.com/questions/42560585/how-do-i-center-text-in-the-tkinter-text-widget

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-15 Thread Peter Otten
Matthew Polack wrote: > *Question 1:* > > *Why cant the program check if 'answer' variable is correct?* Change the line result = "Sorry...you were wrong. in your script to result = "Sorry...you were wrong. Expected {!r}, but got {!r}".format(answer, response) and find out

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-15 Thread Alan Gauld via Tutor
On 15/08/18 01:56, Matthew Polack wrote: > from tkinter import * > > import random > > answer = "global" You have the right concept but the wrong implementation. To declare a variable as global you declare it as normal in the outer scope then inside each function that uses it add a global line