Re: I want to lirn pithon but pithon doesn't want me to do so

For starters your __init__ for Tree calls them x and y, but then you use treex and treey, which  don't exist.

Also, note that the default arguments to functions are only evaluated once.  What you actually want to do is not default the parameters and pass them in when you create the class: Tree(x = random.randint(0, 30), y = random.randint(0, 30)) etc.  As written, every single tree would be at the same place, if you want them to be actually random you have to do it higher up.  In general, in Python, anything that's meant to change as a default parameter will surprise you in bad ways.  That's not crashing you here, but it's not doing what you probably think it is.

When you say "my program crashes", though, you should really tell us with what error.  In fact you shouldn't even have to tell us the error half the time, it should be saying something like missing attribute etc.  I don't know if Lucia sends errors to the console or somewhere else, but it almost certainly sends them somewhere and you should find out where.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Meatbag via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ty via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ty via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector

Reply via email to