15,195 Topics

Member Avatar for
Member Avatar for Loulou_1

I want to draw a checkerboard on Python, but I only get one black square. Can you help me fix this program? import turtle def filled_square(size, color, x, y): turtle.setpos(x, y) turtle.color(color) turtle.begin_fill() for i in range(4): angle = 90 turtle.fd(size) turtle.lt(angle) turtle.end_fill() turtle.up() import sys n = int(sys.argv[1]) s …

Member Avatar for happygeek
0
3K
Member Avatar for Niloofar24

Hello! Can you give me an example of Button widget in Kivy language? I can creat the button but don't know how to use it's callback. I mean how can i set a command for the Button in Kivy?

Member Avatar for M_12
0
5K
Member Avatar for Ade Ihsan

long waitingTime(vector<int> tickets, int p) { // bool flag indicates whether it's Jesse or not queue<pair<int, bool> > aQueue; for(int i = 0; i < tickets.size(); i++) { aQueue.push(make_pair(tickets[i], i == p)); } long long nTime = 1; while(!aQueue.empty()) { pair<int, bool> aItem = aQueue.front(); aQueue.pop(); nTime++; if(aItem.first == 1 …

Member Avatar for rproffitt
0
1K
Member Avatar for Dhelandel

Is it possible to integrate Perfect Circles of the Golden ratio geometry in designing logo based on these link ( https://goo.gl/images/7eYZoG ) to recognize flower.. What do you think guys? Im planning to have a research on this.

Member Avatar for rproffitt
0
288
Member Avatar for shubhangi_1

I want to print the count N letters of string but it result in error can anybody help me? import subprocess variable = "making" s = subprocess.Popen(("grep","-o -w","%s"%variable, "output.txt|wc -w"), stdout = subprocess.PIPE) output = s.communicate()[0] print(output)

0
144
Member Avatar for Tcll

so I'm working on a class for a vector which I want to hash like a tuple, and to do so, a vector instance needs acess to it's properties. here's the constructor for the performative properties I'm using, and the vector class: def newProp(): newdict = {} getter = newdict.get …

Member Avatar for Tcll
0
453
Member Avatar for Aman_14

I have a text file containing the following data. ascon1 201707011 John 77.5 11.5 11.5 11.5 ascon1 201707012 Grld 70.0 11.5 11.5 11.5 ascon1 201707013 Josh 79.5 11.5 11.5 11.5 ascon1 201707014 Jess 67.5 11.5 11.5 11.5 ascon1 201707015 Jack 97.5 11.5 11.5 11.5 I need the data to look …

Member Avatar for pty
0
12K
Member Avatar for DAN_22

# Am looking for best practises of displaying document info in tkinter messagebox from tkinter import * from tkinter import messagebox def profile(): messagebox.showinfo("info","college\tNew student\tGraduating students\noak institue\t202\t210\nPine college\t143\t121") root =Tk() root.geometry("200x200") C = Button(text="copyright",command=profile).pack() root.mainloop() #I think if am going to type all the info in the document the arrangement …

Member Avatar for rproffitt
0
2K
Member Avatar for Nemius

Hello. I am making a program that interacts with MySQL database/table. I ran into 2 problems. The first one is about saving data which user entered into cell/or edited existing data in cell. The second problem is about inserting new row. Row is inserted, but it still shows error in …

Member Avatar for Nemius
0
1K
Member Avatar for DAN_22

I want to display the content of selected treeview only in tkinter but when i select the treeview other treeview content also display but i want only the selected treeview to display. I have working around to get this by the use of style widget but it display other content …

0
134
Member Avatar for mattyd

I am searching for the logical Python logical operator "or"; While C++ is: 1 || 4 (using pipes) I assume Python would simply be "or", as in: 1 or 4 Or something like this: if var1 == "image0.GIF" or "image1.GIF" or "image2.GIF": varValue = 10 Is this syntax for Python …

Member Avatar for rahul_64
0
53K
Member Avatar for Ala'a99

I can make a plot in python its no problem. My question is : Dose there any option to make more than one plot over each other but not in the same time?!(plot the first one wait a bit then plot the second one over the first one and so …

Member Avatar for Gribouillis
0
454
Member Avatar for Tcll

I have an automated API with a secure frontend/backend structure where backend object attributes are hidden with frontend proxy classes. basically, when accessing an object from the frontend, you get a proxy object disguised as the backend object with all it's explicitly "public" functionality. what I'm dealing with right now …

Member Avatar for Tcll
0
461
Member Avatar for sudipta.mml

The quadruplex sequence of a genome looks like this Gx Ny1 Gx Ny2 Gx Ny3 Gx, where G is the Guanine base and the Ns are representing other bases. The x, y1, y2 and y3 are integer. A particular segment will be quadruplex sequence if x>=2. My question is I …

Member Avatar for Matej_1
0
349
Member Avatar for Nemius

Hi all, I am working on program that will connect to MySQL database, colect data from table and show them in grid. Where user can edit cell, and then on enter key changes will bi save directly into database table. Curent problem is that I am stuck at importing data …

Member Avatar for Nemius
0
2K
Member Avatar for farzane_1

hello friends... i want to print a persian file by thermal printer.. i can print an english file esily..but i face the proble while printing persian text.. i think i don't do some principles...i have studied about unicode encodeand decode in python..but it seems it isn't enough please guide me …

Member Avatar for rproffitt
0
2K
Member Avatar for vegaseat

This class gives a specified Tkinter widget a tooltip that appears as the mouse is above the widget. You can improve the code by putting in a time delay.

Member Avatar for Marc_10
7
13K
Member Avatar for Stefce

Hello, so i tried to make my own insta crawler but having some dificulties, here is the code for now: import requests from bs4 import BeautifulSoup def insta_spider(max_pages): page = 1 while page <= max_pages: url = 'https://instagram.com/xenia/' source_code = requests.get(url) plain_text = source_code.text soup = BeautifulSoup(plain_text, "html.parser") …

Member Avatar for rproffitt
0
2K
Member Avatar for reeta_1

A positive integer n is said to be perfect if the sum of the factors of n, other than n itself, add up to n. For instance 6 is perfect since the factors of 6 are {1,2,3,6} and 1+2+3=6. Likewise, 28 is perfect because the factors of 28 are {1,2,4,7,14,28} …

Member Avatar for rubberman
0
330
Member Avatar for breaksand30

I'm working on a project in Python that I'm having trouble with. I've asked so many people but they seem to not be able to help me :/ I'm coding a little program that executes system commands. The idea is that one machine opens the server and the other one …

Member Avatar for reeta_1
0
4K
Member Avatar for willygstyle

Hey guys, I got a little bored and thought I would to make some of the basic Client/Server applications I have a little bit flashier with a gui interface. So far I have just been working with the server and the main problem that I run into is when the …

Member Avatar for Gribouillis
0
5K
Member Avatar for abders

Hello, I was testing a class in a GUI, and that error message showed up. Please help. Code: [CODE]from Tkinter import * class Application(Frame): def __init__(self, master): super(Application, self).__init__(master) self.grid self.create_widgets() def create_widgest(self): self.bttn1 = Button(self, text = "I do nothing!") self.bttn1.grid() self.bttn2 = Button(self, text = "Me too.") self.bttn2.grid() …

Member Avatar for Gribouillis
0
2K
Member Avatar for Abdullah_17

I need to read a list of names from different files using python and produce the list of names that appear the first time from each file. Help!!

Member Avatar for Sue_2
-1
358
Member Avatar for lewashby

I've downloaded the file "qt-unified-windows-x86-3.0.0-online.exe" and installed Qt and I've also downloaded and unpacked the file "PyQt5_gpl-5.9.zip". I'm using Python 3.6 but I can't figure out where to drop the extracted PyQt5 files. I can't find a Python directory anywhere on my C: drive except for under my home directory. …

Member Avatar for lewashby
0
683
Member Avatar for Faro_1

so i tried adding a defintion for the reset command but it doesn't seemed like it works other method was moving the defintion around the localfunction which didn't work and also affects other elements # Guessing Game from tkinter import * from tkinter import ttk import random number = random.randrange …

Member Avatar for Faro_1
0
356
Member Avatar for Hillzy

At the moment i ahve a task where i have to make a guessing game in GUI python. So it will generate a random number and also when a certain number of tries have been reached it will stop. The problems i am having as of now is that: 1) …

Member Avatar for Faro_1
0
3K
Member Avatar for V3N0M

Hi I am learning python and there is these two code snippets but I keep getting an error when I try to run the program. # survey.py class AnonymousSurvey(): # Collect anonymous answers to a survey question. def __init__(self, question): # Store a question, and prepare to responses. self.question = …

Member Avatar for V3N0M
0
279
Member Avatar for Sean___

I've recently been learning on how to write Python. I'm still a beginner. I've read multiple times that creating a text based adventure game in Python is a good exercise to learn the in's and out's. I've finished the basic structure of the script. I've already run the script and …

Member Avatar for Gribouillis
0
627
Member Avatar for Nazneen_1

Hi All, i need to convert this Python code to C# .Tried Some online converters nothing Worked out so far.Please Help. import openpyxl from PIL import Image, ImageTk import Tkinter as tk import subprocess import time import os import RPi.GPIO as IO import sys import glob def Image_dis(img, delay): root …

Member Avatar for alc6379
0
558
Member Avatar for sekmani

Hi guys; I'm new in python and thread ,i start learning by create a simple code but i find some defficult this code below have some function and thread also Queue function to share data between thread this is a part of my code: def PutChar(Ch): #ask user to put …

Member Avatar for sekmani
0
2K
Member Avatar for Siberian

If the user enters only one character, I want it to prompt for the name again; otherwise print the persons name in ASCII. Instead what is happening is it's printing the name depending on how many characters are in the name ? nameAsk = raw_input("What is your name?") for name …

Member Avatar for Gribouillis
0
240
Member Avatar for Howard_2

How to install pygame on Python? pygame is on my laptop ,I try the script setup, install pip, What am I missing??

Member Avatar for rproffitt
0
92
Member Avatar for itian.kongu

Hi all few free tutorial sites for beginners are given below. C PROGRAMMING http://learnermode.com/c-tutorial/ C++ pROGRAMMING http://cplusplus.com Java https://docs.oracle.com/javase/tutorial/ C# https://msdn.microsoft.com/en-us/library/aa288436(v=vs.71).aspx Python https://www.tutorialspoint.com/python/ Java Applets http://learnermode.com/java-tutorial/applets/

Member Avatar for cahendi
2
393
Member Avatar for Robbert

Hi Any one know how I can get the following function to return a value - thanks. [CODE]import threading import time def stringFunction(value): str = "This is string no. " + value return str thread1 = threading.Thread(stringFunction("one")) thread1.join() thread1.start() while threading.activeCount()>1: time.sleep(1) print thread1 [/CODE] Currently returns "<Thread(Thread, stopped)>" Not …

Member Avatar for sekmani
2
29K
Member Avatar for TrustyTony

This is one small snippet of after event usage. You could express if you find this kind of simple code to be usefull as snippet. Notice also vegaseat's sticky message threads in begining of Python forum in addition to code snippets.

Member Avatar for Gribouillis
0
5K
Member Avatar for mohammed_41

how to import datafile using numpy ? i did the following : import numpy as n filename='data_file.txt' data=n.loadtxt('data_file.txt') but it is bot working ?

Member Avatar for Gribouillis
0
219
Member Avatar for monsterTUT
Member Avatar for Rasmus_2
0
194
Member Avatar for funfullson

hi.I want play linux shells command with python.for example i did it: [CODE] def add(userName, pasword): import os os.system("useradd -d /home/%s -m -p %s %s"%(userName, pasword, userName)) [/CODE] but some where i have problem. for example when you want change the users password you have to send the command for …

Member Avatar for Krystor
0
2K
Member Avatar for Krystor

Hello everybody! Today i am writing a program to connect usées without database, with only one function: `createaccount(username,password)` That you must write on the beginning if the program. But i don't know how to finish it, with the "connect" function : class User(): def init(self, inputusername="a", inputpassword="b"): self.username = str(inputusername) …

0
243
Member Avatar for vegaseat

PySide (public license PyQT) is my preferred Python GUI toolkit. Here we explore how to test some of the widgets available and create a digital clock.

Member Avatar for Gribouillis
3
2K
Member Avatar for karmstrong

0 down vote favorite I have created a network scanner, that looks for a specific port on a range of IP's. I would like to thread the application but I am getting and error message ERROR: for worker in range(network.hosts): TypeError: 'method' object cannot be interpreted as an integer Now …

Member Avatar for rproffitt
0
1K
Member Avatar for V3N0M

I am trying to write some code for project euler problem 10, in which you are required to find the sum of all the prime numbers less than 2 million. Now the code is taking too long to execute. I would like to know how can I improve my code …

Member Avatar for filtre
0
459
Member Avatar for Haranadh

I would like to know Which are the python data structures uses divide and concur algorithm? Please explain me?

Member Avatar for rproffitt
0
328
Member Avatar for adanaz

I am making a text adventure and would like the command line window to be a specific size when you run the .py file in the command line window. eg. 300 wide by 250 height. I found a thread on here that shows how to specify the text colour which …

Member Avatar for DubWine
0
18K
Member Avatar for ben.juarez.773

Hello! I am looking for some help, and have provided the code. I'm just trying to do some simple stuff. I'm trying to create a simple game without using classes (but using lists). What I'm trying to do is create collision detection among list objects ("bullets" and "baddies"), as you'll …

Member Avatar for a_9
0
712
Member Avatar for Eric_8

I have a folder with 40 files in it which I want to loop through. When I print out the name of the file my code works fine: import os source = 'pathtofile' for root, dirs, filenames in os.walk(source): for file in filenames: print file It will print : File1 …

Member Avatar for Eric_8
0
14K
Member Avatar for Eric_8

Hi, I am fairly new to Python. I am familiar with the concept to pass data accross functions. In theory, def c(): r = raw_input("Ask Something? ") .. return r def p(x): ... do something r = c() p(r) The code below works just fine via Terminal ( python filename.py …

Member Avatar for Eric_8
0
330
Member Avatar for manyatha

input1: create external table db.emp(id int,name string) row formatted fields terminated by ',' location 'hadfs:.../'; create external table db.emp1(id int,name string) row formatted fields terminated by ',' location 'hadfs:.../'; input2: create table db.emp(id int,name string) location 'hadfs:.../';; create table db.emp1(id int,name string) location 'hadfs:.../'; requeried output: create external table db.emp(id …

Member Avatar for rproffitt
-1
369
Member Avatar for Hubert_2

Hello Need help. I try to insert a background sound in my program but I get ImportError message Below line 8 and 9 of my program import random, time, pygame, sys from pygame.locals import * Below the error message when running my program #C:\Users\user pc\AppData\Local\Programs\Python\Python35-32\python "C:\Users\user pc\SkyDrive\ISN\son essaie.py" #Process started …

Member Avatar for DeanMSands3
0
174
Member Avatar for Jesse_11

I need to make a timer for pygame to sit in the top left of the screen, but have no idea how. I want it to count down from 30secs to 0. please help cause I have no idea.

Member Avatar for DeanMSands3
0
512

The End.