0

When I run the code it says:

:prc(warning): Invalid integer value for ConfigVariable win-size: 864.0
:prc(warning): Invalid integer value for ConfigVariable win-size: 1536.0
Known pipe types:
  wglGraphicsPipe
(3 aux display modules not yet loaded.)
:prc(warning): changing default value for ConfigVariable paste-emit-keystrokes from '1' to '0'.
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
Traceback (most recent call last):
  File "C:\Users\LENOVO\PycharmProjects\pythonProject\main.py", line 37, in <module>
    TextureBox()
  File "C:\Users\LENOVO\PycharmProjects\pythonProject\main.py", line 18, in __init__
    super().__innit(
    ^^^^^^^^^^^^^^^
AttributeError: 'super' object has no attribute '_TextureBox__innit'

Process finished with exit code 1

from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController

app = Ursina()
for z in range(10):
    for x in range(10):
        Entity(
            model="cube", color=color.dark_gray, collider="box", ignore=True,
            position=(x, 0, z),
            parent=scene,
            origin_y=0.5,
            text="white_cube"
        )


class TextureBox(Button):
    def __init__(self, position=(5, 2, 5)):
        super().__innit(
            parent=scene,
            position=position,
            model="cube",
            origin_y=0.5,
            texture="texture.jpg",
            color=color.color(0, 0, 1)
        )
        self.texture_choice = 0
        self.textures = ["texture.jpg", "wood.jpg", "stones.jpg", "blue.jpg"]

    def input(self, key):
        if self.hovered:
            if key == 'left mouse down':
                self.texture_choice += 1
                self.texture_choice %= len(self.textures)
                self.texture = self.textures[self.texture_choice]


TextureBox()
player = FirstPersonController()

This is the program I used. I tried using quick fix but after a while it doesn't apply to the problem. also no matter how many times the correction marks go green and I click run it still says attribute error, I am not sure what I am doing wrong.

Tanay
  • 561
  • 1
  • 3
  • 16

1 Answers1

0

It seems you have misspelled super().__init__(). Try this:

class TextureBox(Button):
    def __init__(self, position=(5, 2, 5)):
        super().__init__(
            parent=scene,
            position=position,
            model="cube",
            origin_y=0.5,
            texture="texture.jpg",
            color=color.color(0, 0, 1)
        )
        self.texture_choice = 0
        self.textures = ["texture.jpg", "wood.jpg", "stones.jpg", "blue.jpg"]

    def input(self, key):
        if self.hovered:
            if key == 'left mouse down':
                self.texture_choice += 1
                self.texture_choice %= len(self.textures)
                self.texture = self.textures[self.texture_choice]

I changed super().__innit( to super().__init__(

Lixt
  • 201
  • 4
  • 19