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 yourself.

Hint: answer in the makeproblem() function is not a global variable.
 
> lib\tkinter\__init__.py", line 3269, in insert
>     self.tk.call((self._w, 'insert', index, chars) + args)
> _tkinter.TclError: bad text index "1"

The first argument of the Text.insert() is a string in a special format. Read

http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/text-index.html
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/text-methods.html

for the details. You have a mix of one float (which may work by accident) or 
two integers (which raises an exception).


> *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?

I don't know, and I'm too lazy to google ;)

 
> txt = Text(root, width=35, height=10, wrap=WORD, font=("arial", 24,
> "bold")) txt.grid(row=12, columnspan=2, sticky=EW )
> 
> 
> *Question 3:*
> 
> My 'Score' check idea..may not actually work...haven't been able to get
> that far yet though!

The score variable is not declared global and not initialised. You cannot 
increment something that doesn't exist.

> Thanks so much for any clues.
> 
> - Matthew Polack
> 
> 
> 
> 
> 
> 
> 
> Matthew Polack | Teacher
> 
> 
> [image: Emailbanner3.png]
> 
> Trinity Drive  |  PO Box 822
> 
> Horsham Victoria 3402
> 
> p. 03 5382 2529   m. 0402456854
> 
> e. matthew.pol...@htlc.vic.edu.au
> 
> w. www.htlc.vic.edu.au
> 


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to