removed *args from Widget
This commit is contained in:
parent
c5c81be6ce
commit
2783dd67dc
7 changed files with 17 additions and 16 deletions
7
NOTE.md
7
NOTE.md
|
@ -1,10 +1,9 @@
|
|||
A faire :
|
||||
Widgets:
|
||||
- Slider
|
||||
- Grille (bataille navale)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Réseau :
|
||||
|
||||
- Connexion entre les joueurs
|
||||
|
|
|
@ -21,7 +21,7 @@ class Scene(ABC):
|
|||
|
||||
# Widget Managing
|
||||
|
||||
def add_widget(self, widget_class: Type["Widget"], *widget_args, **widget_kwargs) -> "Widget":
|
||||
def add_widget(self, widget_class: Type["Widget"], **widget_kwargs) -> "Widget":
|
||||
"""
|
||||
Add a widget to the scene.
|
||||
:widget_class: the class of the widget to add.
|
||||
|
@ -30,7 +30,7 @@ class Scene(ABC):
|
|||
:return: the new created widget.
|
||||
"""
|
||||
|
||||
widget: "Widget" = widget_class(self, *widget_args, **widget_kwargs)
|
||||
widget: "Widget" = widget_class(self, **widget_kwargs)
|
||||
self._widgets.add(widget)
|
||||
return widget
|
||||
|
||||
|
|
|
@ -19,10 +19,11 @@ class Image(BoxWidget):
|
|||
y: Distance = 0,
|
||||
width: Distance = None,
|
||||
height: Distance = None,
|
||||
*args, **kwargs):
|
||||
|
||||
**kwargs):
|
||||
super().__init__(scene, x, y, width, height)
|
||||
|
||||
self.image = Sprite(img=image, *args, **kwargs)
|
||||
self.image = Sprite(img=image, **kwargs)
|
||||
|
||||
self._refresh_size()
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ class Input(BoxWidget):
|
|||
y: Distance = 0,
|
||||
width: Distance = None,
|
||||
height: Distance = None,
|
||||
*args, **kwargs):
|
||||
|
||||
**kwargs):
|
||||
super().__init__(scene, x, y, width, height)
|
||||
|
||||
self._texture_normal: pyglet.image.AbstractImage = texture_normal
|
||||
|
|
|
@ -16,16 +16,16 @@ class Text(BoxWidget):
|
|||
"""
|
||||
|
||||
def __init__(self, scene: "Scene",
|
||||
|
||||
x: Distance = 0,
|
||||
y: Distance = 0,
|
||||
width: Distance = None,
|
||||
height: Distance = None,
|
||||
*args, **kwargs):
|
||||
|
||||
**kwargs):
|
||||
super().__init__(scene, x, y, width, height)
|
||||
|
||||
self.label = pyglet.text.Label(
|
||||
*args, **kwargs
|
||||
)
|
||||
self.label = pyglet.text.Label(**kwargs)
|
||||
|
||||
self._refresh_size()
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class Widget(ABC):
|
|||
It can react to any "on_" event from the scene.
|
||||
"""
|
||||
|
||||
def __init__(self, scene: "Scene", *args, **kwargs):
|
||||
def __init__(self, scene: "Scene", **kwargs):
|
||||
self.scene = scene
|
||||
|
||||
@abstractmethod
|
||||
|
|
|
@ -13,10 +13,10 @@ class FPSDisplay(Widget):
|
|||
A widget that display the current FPS of the scene's window
|
||||
"""
|
||||
|
||||
def __init__(self, scene: "Scene", *args, **kwargs):
|
||||
def __init__(self, scene: "Scene", **kwargs):
|
||||
super().__init__(scene)
|
||||
|
||||
self.fps_display = pyglet.window.FPSDisplay(scene.window, *args, **kwargs)
|
||||
self.fps_display = pyglet.window.FPSDisplay(scene.window, **kwargs)
|
||||
|
||||
def draw(self):
|
||||
self.fps_display.draw()
|
||||
|
|
Loading…
Reference in a new issue