Can a constant be user obtained via user input if it stays constant the...
I am making a maze generator in python(pygame) and want to get the size of the maze from the user. Can I assign this value to a "variable" in the constants module since it will stay this way until the...
View ArticleFlask and FastAPI uploaded file type
The type hint for Flask werkzeug.datastructures.FileStorage.stream is IO[bytes] and for FastAPI fastapi.UploadFile.file is BinaryIO. But when I check the type of an uploaded file using isinstance(), it...
View ArticlePython pyqtgraph how to set x and y axis limits on graph, no autorange
I would like to know how I can set the x and y axis limits that are displayed for a pyqtgraph.GraphicsWindow.addPlot object. I need to display a lot of data inside a loop (hence using pyqtgraph) but I...
View Articlehow can I make a touch scrolling button in tkinter?
hi everyone I have a list of buttons and I want to make them scrolling by touchingI made a canvas inside it frame contain the buttons now how can I make them scrolling?I have try this :def...
View ArticleHow do I receive a non primitive object as query parameter?
I'm trying to receive a nontrivial query parameter object. At the moment it looks like this:@router.get("/my/route")def get_vhist_snap_pnl( param: pydantic.types.Json = fastapi.Query( ...,...
View ArticleNormalization inserting NaN values into my dataframe
I am doing StandardScaler normalization to my dataframe but it is inserting NaN values into some of the rowsMain Functiongames = prepare_data()train_size = int(0.7 * len(games))test_size = len(games) -...
View Articlewhy my python code give me this error : TypeError: unsupported operand...
Editthe problem was with my indentationsOriginal questionI am new user in Python, I have a problem with the None type, I looked different question, but the problem persists.my code is calculate...
View ArticleNumpy Basic Random Number Generation Sonarlint Warning
I have been using np.random.random() to generate random numbers but lately I have been seeing this warning message Use a "numpy.random.Generator" here instead of this legacy function.What is the new...
View ArticleStock indicators Quote dont convert to iterable Quotes [closed]
Please help me, I don’t understand and no matter how hard I try to convert, no matter what I do, it turns out the same thing. Problem with Decimalimport pandas as pdfrom itertools import islicefrom...
View Article'SymbolicTensor' object cannot be interpreted as an integer
I have been trying to implement Peephole LSTM using Tensorflow, and I am getting the error belowErrorbelow is my model and I am not sure why I cant get the input layer in my model summaryModeland below...
View ArticleHow to check if an object is created with `with` statement?
I would like to ensure that the class is only instantiated within a "with" statement.i.e. this one is ok:with X() as x: ...and this is not:x = X()How can I ensure such functionality?
View ArticleWhat does logging.basicConfig do?
I have seen this in a lot of python code what does this do? What is it useful for?logging.basicConfig(level=loglevel, format=myname)
View ArticlePygame causing my animations to layer on top of each other
I have this code for a simple game in PyGame:import pygameimport sysclass Player(pygame.sprite.Sprite): def __init__(self, pos_X, pos_Y): super().__init__() self.sprites = [] self.is_animating = False...
View Articlehow to pack flet app for windows ? i am facing errors
PS C:\Users\alikh\OneDrive\Desktop\Vectras> flet build windowsCreating Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.22.1...OKCustomizing app icons and splash...
View ArticleCuston user form conflict in variables
Trying to use custom forms to use info from models, for signup, login, etc.models.pyfrom django.db import modelsfrom datetime import datetimefrom django.contrib.auth.models import AbstractUser# error...
View ArticleHow to deal with a wrap-around rectangle for an object in pygame if the...
I have some code to wrap a rectangle around some text in pygame:import pygame as pgfont = pg.font.SysFont("Comic Sans MS", 30)def wrapRect(obj, color='Black'): rect = obj.get_rect() pg.draw.rect(obj,...
View Articlecs50 week 6 dna incorrectly identifies sequence
I have been stuck on this for hours. When I run it it says thisdna.py exists:) correctly identifies sequences/1.txt:) correctly identifies sequences/2.txt:( correctly identifies sequences/3.txt...
View ArticleCreate deck of multiple decks of cards using list comprehension [duplicate]
I've created a Card object:class Card: def __init__(self, rank, suit, d=0): self.rank = rank self.suit = suit self.deck_index = dI can make a list of Cards that represents a standard deck, using list...
View ArticleImage processing (resize, rotation) without loops or libs
So, I have a university Python project in development where I need to manipulate an image and apply filters, such as black & white, sepia, etc. Some of the filter options are resize, rotation and...
View ArticleProblem importing scripts in Apache Airflow - Modules Management
When I trying to import a script located in a folder outside dags I got aModuleNotFoundError: No module named 'scripts.send_email'orImportError: cannot import name 'send_email' from 'scripts'...
View Article