无法导入Python类

时间:2016-01-10 21:20:39

标签: python class

这是我的代码

Class c;

// ...
t.async_wait(boost::bind(&Class::print, boost::ref(c), _1));

但是在导入课程时我得到了:

class Game_Events(Setup, Game_Setup):
   def __init__(self):
      super(Game_Events, self).__init__()

      super(Game_Events, self).game_setup(self.map_filename)

以下是TypeError: Error when calling the metaclass bases Cannot create a consistent method resolution order (MRO) for bases Game_Setup, Setup init

Setup

以下是class Setup(object): def __init__(self): self.HERO_MOVE_SPEED = 20 # pixels per second self.MAP_FILENAME = 'resources/tmx/Fesnoria Town.tmx' self.MUSIC_FILENAME = "resources/music/Forest_Song.mp3" init

Game_Setup

我需要首先导入class Game_Setup(Setup): def __init__(self): super(Game_Setup, self).__init__() 类,因为它包含Setup我需要的其他类。

有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

Game_SetupSetup的子类,但Game_Events继承自它们,这是不可能的。我想你应该只从Game_Setup继承来使其发挥作用。