Questions tagged as 'python-3.x'

1
answer

render a pygal graphic in a Qlabel

Good morning I'm trying to show a graph in a qlabel with pixmap and pygal, however it does not work, it throws me an error qn QPixmap from PyQt5 import QtCore, QtWidgets, QtSvg import pygal from PyQt5 import uic from PyQt5.QtGui import QPixmap...
asked by 14.09.2018 / 17:47
2
answers

Dictionaries within a dictionary, python 3

I have a dictionary with lists: d1 = { 'frutas': { ' manzanas': [' verdes', ' 7', ' rojas', ' 5'], 'uvas': [' negras', ' 5', ' verdes', ' 3'] }, ' verduras': { 'papa': ['negras', ' 50', ' blancas', ' 20'], 'cebol...
asked by 16.10.2018 / 00:15
1
answer

How to add all the values of a column - Django

I would like to know how to add all the data in a column of my database. This is my model: models.py class Model(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True) id = models.AutoField(primary_k...
asked by 01.09.2018 / 17:49
2
answers

how do I multiply the value in python

How do I want the result to be 4 and not to be 'aa' of the following source code? set1=input ('Entra letra para multiplicar su valor en numero x2: ') a=2 b=3 c=4 d=5 e=6 muestra=2*set1 print (muestra)     
asked by 19.07.2018 / 06:30
2
answers

use goto in python

I have the following Script. For .py extention of python to do GOTO but I do not know if this works in Phyton v3.3.3 os.system('cls') if Resultados1 == 0: Resultados1 = 0 goto .Nivel_1 if Resultados2 == 0: Resul...
asked by 26.07.2018 / 02:47
2
answers

Mutable fields in Dataclasses, prevent them from being shared by all instances

As a practice, I designed a database with two types of objects. Each of them has several fields, and some of them are instances of classes that I have created for use. As I add objects to the database, I realize that these fields, instead of bei...
asked by 04.08.2018 / 12:50
1
answer

Retrieve id in comboBox

I have the following function to fill a comboBox with the data entered in the form by the user, this works correctly. def onTextChanged(self, text): if text: sql = ("SELECT sec.Nombre as Seccion,sec,idSeccion FROM [Lote] lot \...
asked by 06.08.2018 / 12:55
2
answers

Is there any way to configure Python to detect all errors without having to execute the script?

I would like to know if it is possible to configure Python to warn of all the errors without having to execute the script. I already know that at the beginning of the execution it does a syntactic analysis. But I think that is not enough. I m...
asked by 11.07.2018 / 03:23
1
answer

StackedWidget, fails to show interface.ui

I have a problem, I try to use a stackedwidget to change the contents of my main window but not the one in the taskbar. this is my code: from PyQt5.QtWidgets import QMainWindow,QApplication,QMenu from PyQt5 import QtCore,QtGui,QtWidgets fro...
asked by 10.07.2018 / 23:26
1
answer

Calculate and apply probability in python 3.6

I'm doing a script, and I've been stuck in one step. My question is this: Suppose that I have the variable prob = 0.8 , what I want is that prob is the variable that you choose between two objects. Example: prob = 0.8 perro...
asked by 19.06.2018 / 17:06