Posts by JeanExtreme002 • 5,663 points
331 posts
-
5
votes3
answers126
viewsQ: Why does type "any" exist in Typescript?
I’m studying Typescript and I got to the part about the guy any. What I understand is that the any is used when the type of the value that the variable will have. But if that’s the case, the two…
-
0
votes1
answer53
viewsA: Find repeated values in a list and insert another value in its place with Python
This error is being generated because you are scrolling through each list in your list list and trying to use it as an index, which should be an integer. What you certainly wanted to do is: for i in…
-
0
votes2
answers174
viewsA: What color format should be used in the range parameters of the "cv2.inRange" function?
The color format used in the parameters lowerb and upperb is HSV (Hue-Saturation-Value). Just as Luke Peter commented, and it’s written in this reply in English, the reason for the values SV…
-
-2
votes2
answers174
viewsQ: What color format should be used in the range parameters of the "cv2.inRange" function?
I want to create a mask for my image with Opencv using the function inRange, but I don’t know which color format to use. The documentation only says that the image (first parameter) must be in HSV,…
-
0
votes0
answers33
viewsQ: Canvas animation causing serration in images
I created a game, using JS and Canvas, and when the user starts the game, the scenario and its objects begin to move. The animation of it is done through a requestAnimationFrame, which is run…
-
0
votes1
answer31
viewsQ: How to remove the blue background from the table item when selected?
I have a QTableWidget and I need all items in the table to have the same background color. The problem is that when an item is selected, it gets the background blue. I tried the following code on…
-
-1
votes1
answer45
viewsQ: How does the sum assignment operator work internally?
I am creating a class and I want its objects to be summed up, using the sum operator or the sum assignment operator. I know that to use the sum operator, we must create for the class the special…
-
3
votes2
answers202
viewsQ: How to prevent a class from being instantiated in Python?
I have a mother class and want to inherit it to a daughter class. But the mother class cannot be instantiated, only inherited. In other words, the mother class should be abstract. Although Python’s…
-
4
votes1
answer77
viewsQ: Why does the Math.toRadians method return an inaccurate value?
I was programming a method in which I needed to convert a value from degrees to radians and I wondered if this conversion no longer existed in Java. Searching the Internet I discovered the method…
-
-2
votes2
answers164
viewsQ: How to format a double number to N decimals without rounding?
I have a type value double and I would like to format it so that it gets 3 decimals only, unfurnished. For this, I’m trying to utilize the String.format as follows: float value =…
-
5
votes1
answer73
viewsQ: How to format a string to add spaces to the right in a printed table?
I am trying to print a table in Java using the method System.out.format, where the exit should be this way: (Dados apenas de exemplo. Não são reais.) SBGR -> BCO | 9,0 m | 5,0 NM | 1400 Ft/m |…
-
3
votes1
answer72
viewsQ: How to force the user to pass a type to a generic class?
I have a generic class called Quantity<UnitType>, and in some methods of another class, I need to get an object of that class in a specific type. See the code below: interface UnitType {} enum…
-
0
votes1
answer67
viewsQ: How do I import the "javax.Measure" package without IDE?
I am trying to import, in Java 8 and without using IDE, the package javax.measure with the following code: import javax.measure; public class Measure { public static void main(String[] args) {…
-
2
votes1
answer93
viewsQ: Is it possible to pass an Enum value on your call?
I created in Java a enum for mass measurement units and need the user to pass a value when using it. For example: enum Weight { KILOGRAMS, POUNDS; private float value; Weight(float value) {…
-
0
votes1
answer75
viewsQ: How to add a Qpushbutton to Qtablewidget?
I am creating an application in Pyqt5 with a table, using the classes QTableWidget and QTableWidgetItem. The table has three columns - the first two are just texts and the last one is a button,…
-
0
votes1
answer31
viewsQ: How do I set an event to run when the app ends in Pyqt5?
I am creating an application in Pyqt5 and need to run a code when the application is finishing. For that, I thought about overwriting the method quit class QApplication: class MyApp(QApplication):…
-
0
votes1
answer39
viewsA: How to run widgets that use Qtimer from a different Thread?
I honestly do not know if that is the best solution to this problem, but it is still a solution. Yes, there is a feature in Pyqt5 to create signals and it is the class QtCore.pyqtSignal. Through it,…
-
0
votes1
answer39
viewsQ: How to run widgets that use Qtimer from a different Thread?
I created an application where the user presses a certain key combination - using the package pynput - and a message from a "Qtoaster" appears on screen. Below is an example code: from pynput import…
-
0
votes1
answer30
viewsA: Context Menu does not appear on tray icon when I click with mouse
The problem is that the objects of QAction, at the end of the method execution, they lose their references and are collected by the Garbage Collector. To solve the problem, you must instantiate each…
-
0
votes1
answer30
viewsQ: Context Menu does not appear on tray icon when I click with mouse
I’m creating an app that has a tray icon (QSystemTrayIcon) and I want him to have some options to control the application. For this I created the class below: class QTrayIcon(object): def…
-
0
votes1
answer44
viewsQ: How to align the next lines of a <span> to the first line?
I have a <div> which holds an image and a <span>, and my goal is that the image is aligned vertically to the <span> in the first line and the next lines of the <span> start…
-
0
votes0
answers48
viewsQ: Github Pages cannot find my source in the repository
I sent a website to Github Pages along with some fonts that will be used on the page. The directory structure is this: MeuRepositorio/ index.html public/ ... fonts/ MinhaFonte.TTF css/ style.css…
-
-1
votes2
answers48
viewsQ: DIV element does not position next to "sidenav"
I’m creating a page that will have a fixed sidebar and a <div> with the main content of the page. Below is an example code: .sidenav { height: 100%; width: 160px; position: fixed; z-index: 1;…
-
0
votes1
answer18
viewsA: How to remove the background from Qpushbutton?
I still don’t understand why the following property change the background button, but to remove the background completely, define the property border for none, as follows: QPushButton: flat {…
-
-1
votes1
answer61
viewsQ: How to create an animation for a Graphicseffect property in Pyqt5?
I created a Label to make a slideshow and want to create a transition effect fading between one image and another. To do this effect, I want to define an opacity of 1.0 à 0.0 in my Label. So far, I…
-
-2
votes1
answer18
viewsQ: How to remove the background from Qpushbutton?
I’m trying to create a clickable text - like "that" - in Qt Designer. For this, I created a QPushButton and marked the property flat to remove the background button. At first glance, the background…
-
3
votes1
answer33
viewsQ: How to set a stylesheet for a widget without affecting your child widgets in Pyqt5?
I am creating a window with Pyqt5 Framework and need to add to it a background image. For this, I am setting your stylesheet thus: mainWindow.setStyleSheet('background-image: url("./MyImage.png");')…
-
3
votes1
answer64
viewsQ: What is the access modifier of an explicit implementation?
I created an iterator class that implements the interface IEnumerable<T>, implementing the interface IEnumerable. To make the implementation correctly, it is necessary to explicitly implement…
-
1
votes1
answer38
viewsQ: I cannot create an iterator class with Ienumerable<T>
I’m creating an iterator class - has support for foreach - implementing the interface IEnumerable<T> package System.Collections.Generic, as in the code below: public class MyList<T> :…
-
-2
votes1
answer66
viewsQ: Stack overflow exception being generated in the instance method "Equals()"
I created a class called MyList<T>, with the intention of reproducing the class List, and I overwrote the method Equals to compare your instance with another of the same class, as follows:…
-
0
votes1
answer36
viewsQ: Problems using "using" to access static methods
I created in C# a static class with the methods Decode() and Encode() as in the code below: namespace Crypt { public static class CaesarCipher { public static string Decode(string text, byte key) {…
-
1
votes0
answers41
viewsQ: Why can’t find_packages() find one of my code packages?
I’m trying to generate a distribution package for Pypi by setuptools. The problem is that the function find_packages cannot find one of my packet folders, called win32. The directory tree is as…
-
4
votes1
answer82
viewsQ: Why doesn’t Github Workflow start?
I created in my repository (currently, Github master branch) a Workflow to run the tests of my Python application, using the pytest. I set it to run on ubuntu-latest in Python versions (3.6, 3.7 and…
-
2
votes0
answers52
viewsQ: Why is "c_float()" generating incorrect values?
I am creating a program in Python - using the library ctypes - to read and write values in memory, and I want to be accurate in the size of the data to be read and written. In this case, if the…
-
0
votes1
answer51
viewsA: What is the "hProcess" parameter of the Win32 API Writeprocessmemory function?
The parameter hProcess means Process Handle - the letter "H" is Handle - and it is an integer value as well as the PID (Process ID - Process Identifier). Unlike a PID, a Process Handle is a…
winapianswered JeanExtreme002 5,663 -
0
votes1
answer51
viewsQ: What is the "hProcess" parameter of the Win32 API Writeprocessmemory function?
I am creating a program that needs to read and write a value in a given memory address. For this, I am using the functions ReadProcessMemory and WriteProcessMemory Win32 API - through the package…
winapiasked JeanExtreme002 5,663 -
0
votes0
answers52
viewsQ: What is the asterisk for as "parameter" in Python functions?
I was reading the documentation of version 3.8 of Python, in the part of the new syntax for positional parameters, and found the following function: def f(a, b, /, c, d, *, e, f): print(a, b, c, d,…
-
2
votes2
answers139
viewsA: How to open a list of images with Opencv?
The problem is in the function time.sleep. This function interrupts the execution of the main thread, making the program "sleep". Consequently, the image loading on the screen is also interrupted,…
-
1
votes2
answers64
viewsA: Bug when adding elements to the list and transforming it into a string
Your code problem is in the repeat block. You are using the string size char - which theoretically must contain only one character - in the function range() as a stop point, when you should be using…
-
1
votes1
answer25
viewsA: How to open an app with Speech Recognition?
To open a file in OS - using its default program - use the function startfile module os, passing as argument the file path you want to open, along with the file extension. See the example below:…
-
0
votes1
answer39
viewsA: Error making python formatting using . find command
The problem is that you are trying to use simple quotes inside a string created with simple quotes. The result is an unintentional closure of the string - leaving out the letter A of it - and…
-
2
votes1
answer95
viewsQ: When a calculation is made in C#, is the primitive type of the variable maintained in the result?
I’m creating a simple C# application to calculate some flight information, in which you have a class called Calculator containing the following methods: public static float GetDistance(ushort…
-
1
votes1
answer92
viewsA: Sum the total values of each key of the Python dictionaries
Just create a totally empty dictionary to store the sums and go through each animal from each daycare - checking if the key is different from "nome". That way, you can compute the amount of…
-
2
votes1
answer62
viewsA: How do I find the names on the list?
To check if an element exists in the list - or even in any object that has the method __contains__ - use the "keyword" in as follows: def buscar(lista, animal): # Verifica se "animal" é um elemento…
-
0
votes1
answer57
viewsA: Save python execution as file
To store all the obtained data, you can save it in a JSON file - using the package json from the standard Python library. JSON files store the data in the form of a dictionary. Therefore, you should…
-
1
votes1
answer32
viewsA: Where should the program modules be located?
The behavior of the system does not change due to module cache, because once the module - or package - is loaded, it will be saved to cache until the end of the execution of the program, being…
-
0
votes2
answers221
viewsA: Creating an Entry formatted for CPF in Python (Tkinter)
To format the CPF while the user type it, simply create a function to handle the string and assign an event to the object entry, to perform the function with each button pressed - using the method…
-
1
votes1
answer37
viewsA: I cannot delete the "cloned" folder with Case-Sensitive in my Github repository
You cannot have access to the two folders in the same directory due to your operating system, which does not differentiate files and directories of the same name with lower or upper case letters. A…
-
1
votes1
answer37
viewsQ: I cannot delete the "cloned" folder with Case-Sensitive in my Github repository
I created a repository on Github and sent my application containing an X folder with the full name in lower case, when actually the first letter of the name should be uppercase. To solve this…
-
1
votes0
answers15
viewsQ: How to run a constructor in Pytest?
In my working directory, I have a folder that contains my package and another folder with test files. The directory tree is as follows: Current_dir/ MyPackage/ __init__.py file1.py file2.py tests/…
builderasked JeanExtreme002 5,663