Category "python"

Factory Method Design Pattern in Python

I'm studying Factory Method Design Pattern in Python. I understand the point of using it in principle but still some aspects got me confused when I experiment w

Tkinter: access specifc widgets created with for loop

In my tkinter project I've created an Entry, a Label and two Buttons for each of the line in my line list using a for loop. I've also saved them in a list when

Importing Adam and ImageDataGenerator on google colab failed

I'm implementing a UNet neural network but I'm having some issues while importing libraries. I found a solution for a couple of them, but I still have a problem

Bruteforce python shuffle function

Hello I was wondering how to revert a string that was shuffled with the random.shuffle() function from python. I know that the original string was shuffled with

My Python library will not load and adding path to .zprofile did not work

I've had python 3 insalled on my system for a few months and have never had an issue importing libraries before. After using pip3 to install pygame, IDLE couldn

Update array of ManyToMany field in Django REST framework

I have a Model Plot which looks like this: from django.db import models class Plot(models.Model): class SUNSHINE(models.TextChoices): NONE = N

How to change the windows resolution Scale with python?

I am trying to change the windows display configuration from python with the pywin32 library, I have managed to change the resolution but when trying to change

Python embedding: How can i create a new type dynamically by c meta class in heap?

I have some new types in heap supposed to be created dynamically by meta class whose declaration may like below: // we have meta class PyTypeObject HeapTypeMeta

How can I make the annotation follow the rotation or random crop of the photo in Python?

I want to make datasets of my images for an object detection model. However, I want to try to use random crop and rotating the images to make more datasets but

Dividing a large file into smaller ones for training

I have a very large file and I want to divide it into smaller ones for training. I've read about pickle files, so I split the large file into training-validatio

How to add to opengl pygame VBOs from another process

The problem I'm just trying to make a game like minecraft, but I just can't add to a vbo from another process. The strange thing is that the logs appear two tim

How to understand inaccurate results while using numpy.log?

I wish to calculate the natural logarithm of a value that is very close to 1, but not exactly one. For example, np.log(1 + 1e-22) is 0 and not some non-zero val

How to deal with SettingWithCopyWarning in Pandas

Background I just upgraded my Pandas from 0.11 to 0.13.0rc1. Now, the application is popping out many new warnings. One of them like this: E:\FinReporter\FM_EXT

Get list of all files from Bitbucket with API 2.0 and Python

I used to manage commits of files of my Bitbucket on-premise instance with que API 1.0 and Python. Retrieving list of all files was quite easy with the '/files'

How to read all the tabs url from a chrome browser using Python

I have a python code which reads the url of current tab and prints it. Is there a way to find the number of open tabs in chrome so I can iterate on all tabs and

How do I fix the error of my django form not having cleaned_data attribute?

I have this form: class RegisterForm(UserCreationForm): email = forms.EmailField() class Meta: model = User fields = ["username", "emai

how to run javascript function in selenuim

how i can run this js code in selenuim window.hcaptcha.render = (container, params) => { console.log(container) console.log(params) window.hcaptchaCallback =

Round to 2 Decimal Places Even with Zeros

I am currently using the following logic to round to round to 2 decimal places: billables_all["Parts Charged"] = billables_all["Parts Charged"].fillna(0).round(

properly executing single line in vs code python

hello this is sth simple probably but I want to execute my python code line by line in vs code I am executing the same code without problem in jupiter notebook

Method returns NoneType object

Classes and Objects in Python I'm creating a bot in discord.py, and I have a class which stores all the information related to the user, like name, settings, pr