Python Forum
Multiple classes in another class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple classes in another class
#4
@ Larz60+

Thanks for the quick response. That seemed to solve the issue.
Been using super() in all the books I have been reading but board is not a type of tile so didn't think that was the answer.

Leave it to a simple syntax error on my part. That's usually the issue, but not familiar enough with it to spot it on my own.
Thanks again!! Big Grin

I changed line 7 in board.py to:
self.board = [[Tile()] * self.size for i in range(self.size)]
not getting an error now. but doing further testing to make sure it is working correctly

Ok this still not acting the way I want. I am creating a Lightout game. Only this one has 3 different colors to it (RGB). So if you click on a tile on the board, that tile and all tiles around it change color. After using a looping print statement. I see nothing is changing. Why?

(Sep-08-2017, 12:26 PM)Larz60+ Wrote: After looking at this a bit more, I see you are embedding 'Tile' into self.board.
but Tile still has not been instantiated. This is just the address of class Tile
I'm not really sure what you are trying to do here.
Perhaps you could explain a bit more.

Ok this still not acting the way I want. I am creating a Lightout game. Only this one has 3 different colors to it (RGB). So if you click on a tile on the board, that tile and all tiles around it change color. After using a looping print statement. I see nothing is changing. Why?
Reply


Messages In This Thread
Multiple classes in another class - by Dargonoth - Sep-08-2017, 11:32 AM
RE: Multiple classes in another class - by Larz60+ - Sep-08-2017, 12:06 PM
RE: Multiple classes in another class - by Larz60+ - Sep-08-2017, 12:26 PM
RE: Multiple classes in another class - by Dargonoth - Sep-08-2017, 12:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Can I use logging in a class (without multiple messages) mevan 2 595 Oct-16-2023, 11:08 PM
Last Post: mevan
Question [solved] Classes, assign an attributes to a class not to instances.. SpongeB0B 4 934 May-20-2023, 04:08 PM
Last Post: SpongeB0B
  super multiple parallel classes catlessness 2 1,332 Jun-07-2022, 02:35 PM
Last Post: deanhystad
  How to append multiple <class 'str'> into a single List ahmedwaqas92 2 2,329 Jan-07-2021, 08:17 AM
Last Post: ahmedwaqas92
  Pythonic way to handle/spread alerts class in multiple modules psolar 11 4,615 Feb-12-2020, 04:11 PM
Last Post: psolar
  Save all values to pandas of multiple classes jenniferruurs 0 1,901 Sep-13-2019, 12:10 PM
Last Post: jenniferruurs
  Return Object Created from Multiple Classes emerger 3 3,062 Oct-18-2018, 02:14 AM
Last Post: emerger
  Giving class multiple arguments AndyArsalan 1 4,555 Oct-04-2018, 11:25 PM
Last Post: ODIS
  calling a class multiple times GOB 2 4,283 Feb-02-2018, 05:10 AM
Last Post: GOB
  Using classes? Can I just use classes to structure code? muteboy 5 5,043 Nov-01-2017, 04:20 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020