Questions tagged as 'python-3.x'

1
answer

Python, increasing number of numbers

My goal in the code is to print an increasing order of integers. For example: The user types 2 numbers and I want the growing order to be printed. Ex: n1 = int(input('Digite um número')) #O usuário digitou 9 n2 = int(input('Digite outro'))...
asked by 03.03.2018 / 11:03
1
answer

Importing classes in Python 3

I have three .py files in my directory: Banco.py , app.py , Usuarios.py . My app.py contains the Tkinder import I am using in the code and here I start all my view and import the Usuarios.py class as follows:...
asked by 02.02.2018 / 02:07
2
answers

Indentation in statement else

Hello, I would like a clarification on the difference in the indentation of the else, "out" of the if. In case it is to return the primus numbers to the nth value 'n'. First case: for i in range(2, n): for j in range(2, i): if i...
asked by 05.03.2018 / 21:44
1
answer

Change colors in program using tkinter

Hello, I need to create a function or maybe two to change the background color of the main window without interfering with subsequent events. I wanted to add in the menu> Environment: Light color pattern; Night: dark color, and I want to bind...
asked by 19.01.2018 / 19:57
1
answer

What signal to use to trigger methods from a thread in pyGtk?

I have a Tree View that I need popular with data obtained in a thread, but if I do it apart from it the program has several random problems and errors. Searching I found that the ideal is to trigger a signal from within the thread to be called a...
asked by 10.01.2018 / 22:40
2
answers

How to repeat a code?

Hello, I'm new to python, and I'd like to hear the code right after its completion. Being that there are several If and else in the code. Here's my code for questioning. print ("\n\t CALCULADORA v 1.0\n") escolha = str (input ("escol...
asked by 02.01.2018 / 00:08
1
answer

How to call an attribute of the class in another class in django

I'm trying to create some classes that will relate in a way. The idea is to be a game in which the player will have some options of choice and then his score is based on the punctuation of his choices (rather than a fantasy game). For example...
asked by 28.01.2018 / 17:35
1
answer

Problems using return

My code: def a(): print(1 + 1) n = input() print(2) I do not know how to return only the "n" outside the function to use it with an "if". Ex.: if n in ...     
asked by 09.12.2017 / 17:34
1
answer

UnicodeDecodeError error: 'utf-8' codec can not decode byte when installing rpy2 with pip

I'm trying to install rpy2 which is a package to run R language in python, but gives the error: $ pip install rpy2 < Using cached rpy2-2.9.2.tar.gz Exception: Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-pac...
asked by 16.01.2018 / 02:12
2
answers

Doubt about the slice function

At reply this question that Guilherme Nascimento P. did, there was a question about using the slice , so far I was unaware of it, and found it at documentation I was confused. Searching here in SOpt did not find anything about...
asked by 28.12.2017 / 01:09