How to make a widget based on Button with text and variant? #3622
-
|
Beta Was this translation helpful? Give feedback.
Answered by
TomJGooding
Oct 31, 2023
Replies: 1 comment 3 replies
-
Rather than just give you the answer directly, I would recommend trying a web search to understand Python subclasses and inheritance.. I’ve found that people learn better when they figure out problems on their own. Here's a basic example of a subclass - notice the super() statement which relates to the base class. class Shape:
def __init__(self, num_corners: int) -> None:
self.num_corners = num_corners
class Rectangle(Shape):
def __init__(self, width: int, height: int) -> None:
super().__init__(num_corners=4)
self.width = width
self.height = height |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're almost there, you just need to instead pass the id and disabled values to the base class.