Skip to main content
2 votes
0 answers
66 views

New Dialog Class Incorrect Button Style

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 votes
1 answer
63 views

Using .get() from an entry in tkinter within a class

I am trying to get the entered value from an entry widget to record in a text file, I've tried a lot but am not sure where to go from here. It come up with this Error: Exception in Tkinter callback ...
user30428193's user avatar
1 vote
0 answers
101 views

Exclude methods consisting of a single pass statement from coverage reports in python

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
  • 571
0 votes
0 answers
36 views

Accessing a sibling inner class in initialiser

Consider the following code, if you will: class ParentService: BASE_DIR = '/some/path' class Results(str, Enum): RESULT1 = 'ResultOne.xlsx' RESULT2 = 'ResultTwo.pdf' ...
zkvvoob's user avatar
  • 496
2 votes
1 answer
263 views

Return a different class based on an optional flag in the arguments without factory

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
-2 votes
2 answers
60 views

discord.ext.commands.errors.CommandNotFound: Command "coucou" is not found

I'm trying to create a bot Discord with Python. I created a class MyBot like this: import discord from discord.ext import commands intents = discord.Intents.all() intents.members = True class MyBot(...
Toniixav's user avatar
1 vote
1 answer
44 views

Adding a second class breaks tkinter variable

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
0 votes
1 answer
42 views

I wrote the code for this analog clock, but I don't know why place of the numbers are not correct

import pygame from math import radians, sin, cos from datetime import datetime class Clock: def __init__(self): self.width, self.height = 800, 800 self.white = (255, 255, 255) ...
Mohamad Homaei's user avatar
1 vote
1 answer
62 views

How to inherit (from a parent class) dataclass field introspection functionality?

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,654
0 votes
1 answer
54 views

Trying to center and uniformly space a 4x4 grid of entry widgets within a frame, within a frame class. What am I missing?

First up, I'm really pretty bad at OOP and tkinter/customtkinter and this is only my third project I've built with classes over straight functions, so please excuse my mess. I'm getting there, and ...
nannerpuss's user avatar
0 votes
2 answers
67 views

Python decorators with class methods

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
0 votes
0 answers
34 views

Having a problem with calling the class twice

import tkinter as tk import math,time,random from PIL import ImageTk, Image,ImageEnhance start_time = time.time() window = tk.Tk() window.geometry("300x300") canvas = tk.Canvas(window, ...
MeHocha 333's user avatar
1 vote
3 answers
84 views

How to display an image with classes in tkinter?

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
0 answers
348 views

OpenAI API upgrade from 0.28 to 1.x

I am trying to upgrade the OpenAI 0.28 version to 1.2.2. For doing that I defined the client and replaced the openai chatcompletion with client. Below is the constant file which will be used in the ...
Pushpendra Singh's user avatar
0 votes
1 answer
38 views

How can I substitute an imported python class in a .py file without modifying the file itself?

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

15 30 50 per page
1
2 3 4 5
34