Questions tagged as 'python-3.x'

1
answer

send value to a Qwidget from a different Python class

How can I change the value of a Qwidget from another class? Example: class Primera(QMainWindow): def __init__(self): QMainWindow.__init__(self) uic.loadUi('task.ui',self) self.label_1.setText('linea1') class Se...
asked by 31.07.2018 / 04:33
1
answer

Generate a list from the keys of a dictionary taking into account the values of these keys

For example if you have the following dictionary: {1:2, 2:3} I want to get the following list: [1, 1, 2, 2, 2] That is: there are as many "1" as values indicates the value of the key "1" (2) and as many "2" as values indicates the valu...
asked by 04.07.2018 / 03:44
1
answer

Queries with firebase and python

I have the following problem: This is my database in firebase: path /Usuarios/Administradores/Angel,{'Nombre':'Angel'} create directly within firebase. However, the other 3 believe them from the following code: from fireb...
asked by 09.07.2018 / 17:44
1
answer

Selenium in Python - Implicitly wait and explicitly wait

This happens to me with this function, if I use a time.sllep () it works correctly but from what I understand it is quite inefficient to use it. def visible_en_tienda(driver): time.sleep(2) xpath = "/html/body/div[1]/main/div[2]/section/di...
asked by 09.07.2018 / 19:09
1
answer

Save values in pyautogui

How could I save the values of displayMousePosition() , something like x, y, rgb = pyautogui.displayMousePosition()     
asked by 12.06.2018 / 08:11
1
answer

Problem with authenticate (username = username, password = password) in django

I am trying to make a login for an api with django rest framework, I am guiding myself with this video: link Here is just the code I use in the login view: orders / urls: from django.urls import path, include from . import views from r...
asked by 21.06.2018 / 08:02
1
answer

Error exporting "logistic_regression" in naive Bayes classifier

In this code we try to make a naybe bayes classifier and show a graph with the results. import numpy as np import matplotlib.pyplot as plt from sklearn.naive_bayes import GaussianNB from logistic_regression import plot_classifier imput_file...
asked by 04.06.2018 / 21:41
1
answer

Maximize and restore the window

I have the following code: from PyQt5.QtWidgets import QMainWindow,QApplication, QDesktopWidget from PyQt5.QtCore import * from PyQt5 import uic from PyQt5 import QtCore class Principal(QMainWindow): def __init__(self): QMainWind...
asked by 14.07.2018 / 06:17
1
answer

Change text color of an Entry () disabled

I was discovering a bit more of tkinter and it gives that, doing a Entry , I wanted it to be deactivated but with the text of a certain color. I've tried it with the fg= attribute but it does not work. I tried to report on how to do i...
asked by 24.06.2018 / 17:58
2
answers

exception http.client in Python

I'm trying to handle exceptions I have the following code: conn = http.client.HTTPSConnection (site, timeout = 5) When the waiting time exceeds What exception should I use? try: conn = http.client.HTTPSConnection(site, timeout...
asked by 08.06.2018 / 23:36