Skip to main content
Filter by
Sorted by
Tagged with
2 votes
0 answers
66 views

I was trying to make a subclass that acts like the original but its go function returned the string of the text of the button, instead of the index of the button. My own defined subclass makes the ...
Randumb_ASH's user avatar
1 vote
0 answers
104 views

In my class, I have some methods that can be overridden by subclasses, but do not need to be. I like to test my project and generate a coverage report using coverage.py. Because the method of the ...
502E532E's user avatar
  • 581
2 votes
1 answer
267 views

I am implementing a series of classes in Equinox to enable taking derivatives with respect to the class parameters. Most of the time, the user will be instantiating class A and using the fn function ...
JamesVR's user avatar
  • 173
1 vote
1 answer
44 views

I have a class for a GUI with two radio buttons one to set save_to_excel to True and the other to False. However I wanted to add a loading screen using threading, but when I add that second class the ...
usherא's user avatar
  • 21
1 vote
1 answer
62 views

I have a parent dataclass, and various other classes will then extend this parent dataclass. Let's call these dataclasses DCs. In the example code below, see ParentDC, and an example ChildDC: from ...
bzm3r's user avatar
  • 4,664
0 votes
2 answers
67 views

I want a decorator that I can use as both @decorator and decorator() with class methods, like this : def decorator_with_args(name): print(f'Hello {name} !') def decorator(func): def ...
Prasun Kumar Khan's user avatar
1 vote
3 answers
84 views

import tkinter as tk from PIL import ImageTk, Image window = tk.Tk() window.geometry("300x300") canvas = tk.Canvas(window, width=300, height=300,bg="red") canvas.pack() class ...
MeHocha 333's user avatar
0 votes
1 answer
40 views

What I'd like to achieve is: b.py(might be in a third party package I cannot modify): from xxx import A class B: def __init__(): self.a = A() The file I actually execute: execute.py ...
Feephy's user avatar
  • 143
-1 votes
1 answer
101 views

I'm trying to add class variable values to a list inside a function, but I'm not seeing any errors or the expected output? The comboxbox doesn't display when I uncomment the list code. Outside of the ...
James-Jesse Drinkard's user avatar
0 votes
3 answers
123 views

I'm trying to wrap two threaded functions inside an object and run a couple of instances of the object. So far I could only run the objects if I pull the threading outside the class. import threading ...
R.Orteza's user avatar
1 vote
2 answers
131 views

I have the following situation: A module that contains a class Foo with some additional convenience functions for assembling Foo objects. A Foo object contains methods for interacting with data in an ...
Ash's user avatar
  • 205
4 votes
3 answers
238 views

In Python, how do I correctly define a classmethod of a parent class that references an attribute of a child class? from enum import Enum class LabelledEnum(Enum): @classmethod def list_labels(...
SultanOrazbayev's user avatar
0 votes
0 answers
241 views

these codes were running flawlessly on tensorflow==2.15, for the purpose of GPU acceleration, I switched to tensorflow-gpu == 2.10.1 with keras 2.10, respectively. and this ValueError raised up on my ...
pepCoder's user avatar
  • 329
0 votes
0 answers
41 views

I have two classes Player and LineUp, one is used within the other (shown below). I am trying to update my LineUp class after I have already instantiated it. class Player: def __init__(self, ...
PureSlurp's user avatar
0 votes
1 answer
48 views

What informs the code that The relationship between the Franchise and Menu classes is that The Franchise class has an attribute menus that stores instances of the Menu class, when clearly Menu and ...
Joseph Matheri's user avatar
0 votes
1 answer
555 views

I'm facing an issue while working with a custom class in Python. I have a module named 'my_module' with a class called 'MyClass'. However, when I try to instantiate the class in another script or ...
Albin Siby's user avatar
0 votes
0 answers
27 views

I am using boto3 library to establish connection to an s3 compatible storage. I had created a class with constructor that take cluster details, access key & IDs as inputs, having these initiated. ...
vpothurajula's user avatar
-2 votes
2 answers
118 views

from dataclasses import dataclass @dataclass class ThreeDPoint: x: int | float y = 0.0 z: int | float = 0.0 point_1 = ThreeDPoint(1.0,2) point_3 = ThreeDPoint(1,2) print(point_1 == ...
anonNEWlearner's user avatar
0 votes
0 answers
33 views

I'm have an unexpected problem. This is a random example, but describe the problem it self. With this code: class Location: def __init__(self, name: str) -> None: self.name = name ...
Miguel A. Díaz Castillo's user avatar
0 votes
2 answers
867 views

I've got a class and would like to apply a decorator to all functions within that class without having to add a function decorator to every single function. I know that there are solutions like the ...
Strawbert's user avatar
0 votes
2 answers
48 views

I am trying to make a program in which you can draw different shapes. I already managed to embed the turtlescreen into my already existing Tkinter one (root) and got a Tkinter Menu, in which I can run ...
Akemi's user avatar
  • 1
0 votes
1 answer
155 views

I am trying to run the below code using dataflow, where I have 2-3 functions defined inside a class, out of which 2 functions are working but the send_email() is working nor throwing any errors. ...
Sandeep Mohanty's user avatar
-1 votes
1 answer
75 views

Here's the complete class code with an example of its implementation. import tensorflow as tf import numpy as np import time from tensorflow.keras.applications.inception_v3 import InceptionV3 from ...
fares rs's user avatar
2 votes
1 answer
2k views

I am trying to set a permanent attribute on a class to be used by other methods throughout the life of the instance of the class class Test: @cached_property def datafile_num_rows(self) -> ...
metersk's user avatar
  • 12.7k
1 vote
2 answers
212 views

I am trying to add a button to toolbar. The button is a custom class that inherits ToolToggleBase. In my custom SelectButton class, I want to pass few arguments, but I getting an error: import numpy ...
Alon123's user avatar
  • 174

1
2 3 4 5
11