15,175 Topics
| |
Hi, I'm trying to teach myself the Python language with the Google Python class ([url]http://code.google.com/edu/languages/google-python-class/set-up.html[/url]). With the exercise 'wordcount' I get a Traceback error (with the main function and sys.exit(1) function). Even with the solution script (as displayed here). Does anyone recognize this problem and can some one tell me … | |
How do I rotate image in this code every n seconds http://pastebin.com/SKDzuC15 lets say i want to change the image in pixmap after 5 seconds to next image, what is happening right now the last one gets displayed. | |
I started this for any information on new python modules apart from standard library. Many people (Including me), aren't willing to move into p3k due to lack of external/non-standard modules. So I started this to keep ourselves informed on New Python 3 Modules. No Limitation, ANY PYTHON 3 MODULE | |
I need help with the button action for this code. When you click on the button, a new window should open with the GIF image of the horoscope sign. The name of the GIF image files are "Pisces.gif", "Taurus.gif",etc. from Tkinter import * #Call all modules for TKinter in order … | |
Just a simple image file slide show using PySide (PyQT). | |
Programming Python 3rd Edition by Mark Lutz has example code (below) where a variable seems to be assigned with options ("or") but what the criteria for selecting the options is not clear. The explanation is almost non-existent but I think this is to do with feeding in a variable number … | |
Hello! I am a newbe to python and apologize in advance for this question, because I am sure it is an easy fix that I am oblivious too - I wrote this simple program for a guessing game- very basic, which is fine - but when you get to the … | |
Hi there, I am a newbie in programming. Python is my choice. because it is easy to learn. But the Tkinter GUI making is horiible. I don't like to write code for GUI. I like the visual basic method. So i installed Qt Designer. But i don't know how to … | |
Maybe a list comprehsnion is not the right way to go here. I want to define a nested list that a user can tell how many lists and how many entries in each subllist. Then have random call a value for each entry in the sublist, working on unique entries … | |
I'm new to Python, but I can use a library to do this, right? Like this one: import pprint import scipy import scipy.linalg # SciPy Linear Algebra Library A = scipy.array([ [7, 3, -1, 2], [3, 8, 1, -4], [-1, 1, 4, -1], [2, -4, -1, 6] ]) P, L, … | |
Hi I am struggling with assigning values to a list of a list. This is my full code. import random #get user input as to size of range range_size = 0 if range_size == 0: try: range_size = int(input('Size of Range?: ')) except ValueError: print('That was not an integer!') range_size … | |
Can someone please help me with this because it is driving me crazy. I wrote a program which prompts the user to enter a number I convert the string to an integer when i print the value it sometimes comes out as a decimal e.g. 3.0 I thought an integer … | |
# This is my code for a space invaders-like game in pygame. How do I add a second enemy? # from pygame import * import random class Sprite: def __init__(self, xpos, ypos, filename): self.x = xpos self.y = ypos self.bitmap = image.load(filename) self.bitmap.set_colorkey((0,0,0)) def set_position(self, xpos, ypos): self.x = xpos … | |
I have been trying to find the frequency distribution of nouns in a given sentence. If I do this: text = "This ball is blue, small and extraordinary. Like no other ball." token_text= nltk.word_tokenize(text) tagged_sent = nltk.pos_tag(token_text) nouns= [] for word,pos in tagged_sent: if pos in ['NN',"NNP"]: nouns.append(word) freq_nouns=nltk.FreqDist(nouns) print … | |
Note: this isn't a questional thread. I need help in building an accurate and efficient Vector class which supports 1D to 4D vectors with their various manipulation/transformation methods. in the end, I want the result to be a reference for other users to copy from. this class is not meant … | |
I have to append first 3 sentences of this sample text to a file(data.txt). So far I've done this: import nltk text="""First patented in 1876 by Alexander Graham Bell and further developed by many others, the telephone was the first device in history that enabled people to talk directly with … | |
Hello, When i try to insert some datas with python to MySQL database where the fourth column is a variable , (it depends on the variable "e0") , i get a message error here is the query syntax : `cur.execute('insert into suiviactuelms (modelsa,date,heure,%s) values (%s,%s,%s,%s);',(e0, modelidvar, cur_date, t, quantitevar))` and … | |
I'm pretty new to coding with Python and I am trying to save a users username in a session variable which should be a new entry in the session dictionary. The code I have is from bottle import route, request, debug, run, template session={'logins':0} def checkLogin(name,password): if name==password: return True … | |
Hi, I am new to Python and am looking into web development frameworks i.e. Pyramid. Is there anyone here who is familiar with this Framework using MongoDB? I am using pymongo and Ming I follwed a tutorial [here](http://pieceofpy.com/2012/01/10/working-with-pyramid-and-ming/). I am getting an `AttributeError: 'str' object has no attribute '_auto_ensure_indexes'` in … | |
Are there any built in modules in python 3.3.0 that can handle images? | |
Here little debugged version of my calculator posted earlier in GUI calculator thread. I prepared it after listening that their teacher did more limited calculator in around 150 lines of code with their graphics module. This is 115 lines without empty lines and comment lines [CODE]>>> li=[i for i in … | |
hello, I want to compare 2 strings.I want to find if a list with characters contains all the letters in a string. If **all** the letters in the string are in the list. For example: > mystring='abc' > mylist=['a','b','c'] must return True > > mystring='abc' > mylist=['a','c','b'] must return True … | |
ok guys I really need help with this homework assignment that my teacher sent I really dont know where to start a little help will be great. You are to write a program that will compute grades. Its input will be a file containing semester scores in TAB-separated format as … | |
# Heading Here #Hello ## I am reading a book that doesn't do a very good job of explaining things. It is talking about parallel arrays and gives an example of pseudo-code. I am trying to figure out how to access the parallel arrays using python and I wrote this … | |
I'm programming a UI mock-up and need to make the window of fixed size and position. The lines of code for setting the size are as follows : widthOfScreen = mainGUI.winfo_screenwidth() #Get the width of the screen heightOfScreen = mainGUI.winfo_screenheight() #Get the height of the screen mainGUI.geometry("%dx%d+0+0" % (widthOfScreen, heightOfScreen)) … | |
Hello, my code works fine when I don't have white spaces but I can't make it work when the string has. I am trying sth like: def lengthR(mystring): count=0 if mystring=='': return 0 while (mystring!='') and (' ' not in mystring): mystring=mystring[0:-1] lengthR(mystring) count+=1 return count but it returns 0 … | |
I have an openstack setup with ceilometer (polslter and notifier) installed. I am getting the required metrics like Storaeg_objects_incoming_bytes, storage_objects_size of swift in the metering tab. how ceilometer is getting these metrics.. what are the underlying components of swift which ceilometer api is communicating.. i am writing a python code … | |
# Heading Here # Trying to add a webcam fee to a panel inside of my wxpython GUI. I have buttons on the left currently, and a black panel on the right. I'm confused as to how to add a webcam feed to that panel? here is the code being … | |
It seems like the slotDirChanged is getting executed twice, becuase everything seems to be working fine, import datetime from PyQt4 import QtGui,QtCore from PyQt4.QtCore import pyqtSlot import sys import os class WatchFilesBin(QtGui.QMainWindow): def __init__(self, lookinpath=None): super(WatchFilesBin, self).__init__() self._filesBinPath = lookinpath createFilesBin(self._filesBinPath) self.filesList = os.listdir(self._filesBinPath) print self.filesList self.fileSysWatcher = QtCore.QFileSystemWatcher() def … | |
Hello everyone i have an issue with this problem, the problem is i need to reset the count after every line in the file, i put a comment so you can see where i want to reset the count. The program is suppose to cut each line after every specified … |
The End.