Posts by HelloWorld • 843 points
35 posts
-
-2
votes2
answers145
viewsQ: What are the disadvantages of protecting a string of objects from a nullPointerException using the optional map?
For example: public static void main(String[] args) { Cidade cidade = new Cidade(); Estado estado = new Estado(cidade); Endereco endereco = new Endereco(estado); Loja loja = new Loja(endereco);…
-
4
votes1
answer370
viewsA: How to validate an array if it has objects inside it or not? React JS
If all the data of each index of your array is of the same type, you can check the type of one of the indices and based on that choose which type of option you will render. You can check like this:…
-
1
votes0
answers207
viewsQ: How to make multiple dynamic graphics with Pyqt5?
I need to do four dynamic graphics on a single screen but I can’t find how to do it. I can only show one chart at a time. I used the code below as an example, but I can’t create four charts and show…
-
2
votes1
answer1160
viewsQ: How to make dynamic graphics in Python 3?
I’m doing a program for Raspberry Pi that scans temperature sensors and stores these readings in a buffer. I need to make a dynamic graph that shows the relationship between temperature and current…
python-3.xasked HelloWorld 843 -
20
votes2
answers2035
viewsQ: What is the Python semicolon function?
I found some codes that had variables inside classes, finished in semicolons. I don’t understand why, and I haven’t found anything on the Internet about it either. class exemplo():…
-
0
votes2
answers326
viewsA: Data analysis with python list
I made a simple function that reads the file and returns a list with the data of the desired state. From there you can make calculations, static, or whatever you want with the data. def…
python-3.xanswered HelloWorld 843 -
0
votes1
answer408
viewsA: Python Arduino - Serial Communication
Here’s a class I created to communicate via Python. With Python code just use the Arduino serial communication libraries to receive and send the data. In the class you have the method to send a data…
arduinoanswered HelloWorld 843 -
2
votes2
answers196
viewsA: Multiplication and division result with two boxes after the comma
You can use the round function to round the values, then display the values correctly with the print function. The characters that appear are the values in scientific notation. print('Bem vindo ao…
-
1
votes1
answer375
viewsA: Why doesn’t Pycharm show the methods of a class?
I was able to solve my problem by updating the Python interpreter inside Pycharm. 1) First click on the top tab in File ->Settings. 2) I clicked on Project: Untitled (Name of my project) ->…
-
0
votes1
answer375
viewsQ: Why doesn’t Pycharm show the methods of a class?
I want to know why Pycharm doesn’t show the methods of a class by pressing control + space. Normally IDE’S show all methods present in the class. In the image below I show what the IDE suggests of…
-
0
votes1
answer1354
viewsQ: How to make a timer in Python 3?
I have to make a timer that counts x seconds, but does not stay in a loop waiting for time to pass, instead it should count the time and generate an event when closing the preset time count. I need…
-
7
votes2
answers3036
viewsQ: How to check which file is the latest in a Python folder?
Suppose you have a folder with several files .txt, with different names, I need to know the latest file. How do I do this using Python?
-
1
votes0
answers56
viewsQ: How to check connected tty ports in Python?
I have a device that is connected to the computer and I need to verify which devices are connected and information about the device, to then take the name of the port and initiate a communication.…
-
0
votes1
answer84
viewsQ: Why is the text label not changed?
I have a screen class, which contains a label of text, the code loads an xml containing the objects. py screen.: #!/usr/bin/python3 import gi import modulo_arquivos import os…
-
4
votes2
answers477
viewsQ: Why is the variable not modified?
I have the following code below: #!/usr/bin/python3 # VARIÁVEIS variavel = 0 def valores(): if ( variavel == 0): variavel = 100 elif (variavel == 1): variavel = 200 elif (variavel == 2): variavel =…
-
0
votes1
answer147
viewsQ: How to disable text cursor?
I have a project in Gtk, which uses a Gtk.Entry text input and I need to disable the text cursor, or make it invisible. How can I do this? Or if I can’t, you can disable the linux system cursor?…
-
0
votes3
answers381
viewsQ: How to use Raspberry as a super user?
I’m using a Raspberry in which I installed a Python program with its files and report folder. The problem is that I cannot delete the files, because only super user can. I need the user to be able…
-
0
votes2
answers7124
viewsQ: How to get the directory from the location where a . py file is running?
I have a file. py of setup, so every time it runs I need to know the directory from where it is running, how can I do this?
-
3
votes2
answers1882
viewsQ: How to create a. trusted desktop file on Linux?
I have the following file . desktop to open a file in Python, it is working, but every time before running opens a dialog box saying that the application launcher is unreliable as per the image…
-
1
votes1
answer73
viewsQ: Why is the source not changed in Raspberry Pi?
I have a graphical application using Gtk in Python, the program has font definitions and font sizes. When running the program on linux works correctly, but when running on Raspberry the source is…
-
1
votes1
answer2885
viewsQ: How to open a Python file selection window with GTK?
I have a Python application using GTK graphical user interface. This interface consists of a screen with data input a button, the goal of the program is to save data in spreadsheets in a specific…
-
1
votes2
answers13897
viewsQ: How to remove specific position characters from a string?
I have a string read from a file that contains a data and the special new line character ' n'. Example: dado = 'teste \n' First I check the size of the string, then I can remove the last two…
-
0
votes1
answer135
viewsA: Communication with baudrate 110
One option is to use the Python language using the pyserial module. It is a very versatile module, being able to receive several configurations of the serial communication and standards. An example…
-
2
votes1
answer376
viewsQ: How to make a "compilation" of the code in Python?
Knowing that Python is an interpreted language, is there any way to compile the program in Python? By this I mean, how to check syntax errors without having to wait for such part of the program to…
-
1
votes1
answer130
viewsQ: How to open a csv created in Python without opening an import screen?
I have created a Python csv in several ways as can be seen below, but every time I open the file opens the import screen as below. Why does this happen? And how can I make the file open directly,…
-
1
votes1
answer992
viewsQ: How to write a . csv file in Python including file settings?
How can I create a csv file containing column width information and configured header and things like that, is it possible? or we can only write the data without any configuration?
-
0
votes1
answer1153
viewsQ: How to verify the existence of a file and the number of lines written in Python?
How best to check whether the file is existing and the number of lines inside the file.
-
0
votes2
answers65
viewsQ: Why can’t variables from the same instance be read in different processes? (Python)
I have two processes going on and I have a class containing a method that modifies a value, as you can see in the code below. The Eventoboton function represents a click to modify a value. But the…
-
0
votes1
answer47
viewsQ: What problem can occur when retouching a value without having a variable to receive (Python)?
If I have a function that returns a value or True and False, but doesn’t have a variable to receive, this may cause some problem in the functioning of the code? Example: def Retorna(): return False…
-
0
votes1
answer390
viewsQ: How to modify a list within a Python method?
Suppose I have the following method and the following list: def ModificaValores(Valores): dados = [6,5,4,3,2,1,0] Valores = dados Valores = [0,1,2,3,4,5,6] print(Valores) ModificaValores(Valores)…
-
4
votes2
answers1153
viewsQ: How to transform integers into byte in the Python language?
I’m using the pyserial module to send serial data, so I have a list of values like: Valores = [10,20,30,40,50,60,70,80,90,100] I need to transform the values of the list into bytes to send, because…
-
1
votes1
answer949
viewsQ: How to check the type of elements in a Python list?
I have a list of data, and I need to verify that all elements are integer or string, or any other type of data. It is possible to verify all elements or needs to be one by one? For example: Lista =…
-
2
votes1
answer59
viewsQ: Why is the class attribute not modified?
I only need to send a command from one process to the other, but I wanted to understand why when modifying the variable within a function, it does not appear in another function. from…
-
1
votes1
answer1300
viewsQ: Exchange of information between Python classes
How can I exchange information between two different classes? I need to pass data from one to the other. Each class is running in a different process. An example of the structure, the code is too…
-
1
votes1
answer495
viewsQ: Multiprocessing with python infinite loop functions
I’m doing a graphical interface with Gtk in python, and I have a serial script that keeps sending and receiving data from a microcontrolled system. The serial script is in an infinite loop (while…