Questions tagged as 'python'

1
answer

Why does not font change in Raspberry Pi?

I have a graphical application using Gtk in Python, the program has font definitions and font sizes. When running the program in linux works correctly, but when running on Raspberry the font is not changed. Does anyone know why this happens?...
asked by 06.02.2018 / 19:28
1
answer

NameError: name 'Window' is not defined [closed]

I'm following this PDF , I'm on page 10, the code gives error and I I do not know why. from tkinter import * class Janela: def __init__(self,toplevel): self.fr1 = Frame(toplevel) self.fr1.pack() self.botao1 = Butt...
asked by 28.11.2018 / 13:44
1
answer

Algorithm to determine the prime numbers between 2 and N. What is wrong?

n = int(input("Digite N: ")) lista =[] divisores =[] for i in range(2, n+1): for j in range(1,n+1): if i>=j: if i%j ==0: divisores.append(j) print("divisores",divisores) if...
asked by 23.03.2018 / 01:35
1
answer

Abstract classes in Python

The __subclasscheck__ method must be defined at the metaclass level, since the __subclasshook__ method can be defined as a class method since the class has a ABC metaclass (or one of its derivatives). My question is when we c...
asked by 02.04.2018 / 08:36
1
answer

What does this variable mean?

I'm messing with python and pycuda, studying codes and etc and I came across the following question: What's happening exactly on the second line? service will receive some attributes, in the first line, and until then everything okay. However in...
asked by 21.05.2018 / 21:29
1
answer

How to remove list item within loop? [duplicate]

I'm trying to delete an item inside a loop. I already learned that it is not possible. I'm seeing how to implement a comprehensive list. But I still do not understand how it works. I tried to do this: result = [x for x in range(0, len(lis...
asked by 21.05.2018 / 15:53
1
answer

How to improve a bar graph whose values are very close in Python?

I'm drawing the bar graph using the following Python code: # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib.dates as dates from datetime import datetime, timedelta x = [] y = [] with open("Tem...
asked by 14.09.2017 / 15:52
1
answer

Magic methods of python in javascript

Python objects have some magic methods like __init__ , __str__ , __eq__ , __ne__ , __gt__ , __lt__ , __ge__ and __le__ . How to simulate these methods in javascript, when I do console.log(obj)...
asked by 11.10.2017 / 00:08
1
answer

Solve a polynomial between two values

x = eval(input()) x = eval(input()) polinomio = 3*x**3- 5*x + 0.8 for x in range (x,x,0.5): print(polinomio)    Traceback (most recent call last):     File "C: /Users/User/AppData/Local/Programs/Python/Python36-32/fdrew.py", line 4, in    ...
asked by 23.10.2017 / 05:21
1
answer

How to manipulate strings with ".find"

Can I use ".find" to make the program search for a word within a typed text and say whether it exists or not (true or false) and in which line of text it is located, if not, which command use to do this? What I already have: a = str(input()) #...
asked by 25.10.2017 / 19:39