[Tutor] were do i put the random number genorator

Bob Gailer bgailer at alum.rpi.edu
Fri May 11 07:22:36 CEST 2007

```Treloar, Nick wrote:
> i am tyin to make a number guesing game were do i put the random
> genorator it the top of each child screen def
Did you write this program yourself? Do you understand it? What is it
supposed to do? I personally don't understand it enough to address your
question.
> here is my code
> from Tkinter import*
> root = Tk()
> root.title("main screen")
> root.maxsize(width=350,height=200)
> root.minsize(width=350,height=200)
> root.resizable(width=YES,height=YES)
>
> def child1():
>         c1 = Toplevel(root)
>         c1.guess_ent = Entry(c1, width = 35,)
>         c1.guess_ent.grid(row = 14, column = 0)
>         c1.box_txt = Text(c1, width = 35, height = 5, wrap = WORD)
>         c1.box_txt.grid(row = 3, column = 0, columnspan=2)
>         c1.title("easy")
>         c1.geometry("200x200")
>         Button(c1,text="clear", command = NIck).grid(row=1,column=0)
>         Button(c1,text="new game",).grid(row=1,column=1)
> def NIck():
>     child1.box_txt.delete(0.0, END)
>
> def child2():
>     c2 = Toplevel(root)
>     box_txt = Text(c2, width = 35, height = 5, wrap = WORD)
>     box_txt.grid(row = 3, column = 0, columnspan=2,sticky = W)
>     c2.title("medium")
>     c2.geometry("200x200")
> def child3():
>     c3 = Toplevel(root)
>     box_txt = Text(c3, width = 35, height = 5, wrap = WORD)
>     box_txt.grid(row = 3, column = 0, columnspan=2,sticky = W)
>     c3.title("hard")
>     c3.geometry("200x200")
>
> Label(root,text = "choose which game you would like to
> play").grid(row=0,column=0,columnspan=2)
> Button(root,text="easy",command=child1).grid(row=1,column=0)
> Button(root,text="medium",command=child2).grid(row=1,column=1)
> Button(root,text="hard",command=child3).grid(row=1,column=3)
>
>
> /This message is intended for the addressee named and may contain
> privileged information or confidential information or both. If you are
> not the intended recipient please delete it and notify the sender./
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>

--
Bob Gailer
510-978-4454

```