Migración sobre interfaz gráfica para python PYQT5
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import pymysql
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
from Proyecto2n.Recursos import Constantes
|
|
|
|
import sys
|
|
|
|
|
|
|
|
class queso():
|
|
|
|
def __init__(self):
|
|
|
|
try:
|
|
|
|
conn = pymysql.connect(host=Constantes.host, port=Constantes.puerto, user=Constantes.user,
|
|
|
|
passwd=Constantes.passwd, db=Constantes.db)
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
labels = []
|
|
|
|
sizes = []
|
|
|
|
cursor.execute("SELECT numero, count(numero) FROM `dado6` group by numero")
|
|
|
|
for numero, tnumero in cursor.fetchall():
|
|
|
|
labels.append(numero)
|
|
|
|
sizes.append(tnumero)
|
|
|
|
|
|
|
|
fig1, ax1 = plt.subplots()
|
|
|
|
ax1.pie(sizes,labels=labels, autopct='%1.1f%%',
|
|
|
|
shadow=True, startangle=90)
|
|
|
|
ax1.axis('equal')
|
|
|
|
plt.show()
|
|
|
|
|
|
|
|
except:
|
|
|
|
print("No tengo datos suficientes para realizar un diagrama de queso")
|