15,175 Topics
| |
Hi there guys i've got a script that's suppose to find the average of two times as strings. The times are in minutes:seconds:milliseconds i'm doing ok in printing the right minutes and seconds my problem is with the milliseconds. **Example if i have 00:02:20 and 00:04:40 the average will be … | |
Hello. How do i make a flood fill in python? For exampel. I choose to download this picture of world countries. I save this as picture.png in a folder. The folder also contains a python file whith the name change.py. The change.py file is gonna change USA to yellow. To … | |
My Python environment: Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] on win32 I have a script that has been running for months. It's a cron job and suddenly it started throwing this error: *pymysql.err.Error: (<class 'TypeError'>, TypeError("'int' does not support the buffer interface",))* I don't … | |
Hi all, I have a class with a variety of methods, for example: class Foo(obj): def meth_a: ... def meth_b: ... In reality, Foo may have 50 or more methods. And for various reasons, I cannot subclass Foo. I'm using Foo in a composition class with some added functionality. Let's … | |
Im writing an address book to use from terminal, how would I return the users contact info from the end-users input from the dictionary I created? | |
Hi there, I'm just a hobbyist teaching myself python but I am making progress with the help of "Rapid GUI Programming with Python and QT". I have written what is probably a very poorly designed programme which does just about what I want but when it's closed the process continues … | |
First of all I'm using pythong 2.7.3 and libtcod 1.5.1 I am following a tutorial found at http://roguebasin.roguelikedevelopment.org/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod,_part_2 and have code matching (as far as I can tell) exactly what it is telling me to do. My code is below. The general idea is to create a white and yellow … | |
I've been trying for a while and can't figure it out http://pastebin.com/4PZj2c9s | |
Write a Python program to apply the given formulae above to complete the missing information in Table 2.2. As vMax (his speed at 30,000m) is an unknown, allow the user to input a value of between 500m/s and 600m/s, each time displaying a new completed table. For an extra 3 … | |
I have been making an Adventure Game and when I try to test it, it always comes up with Hello! Welcome to the adventure game! What is your name? Parsia Parsia? Well hello there! Let us begin... You are at a trail with two paths. Left or right? left Traceback … | |
Hi guys!, I thought i'd try and learn a bit of python to keep myself occupied, and i was wondering if you could give me some constructive criticism on a word guessing game i have created. I'm an amatuer programmer and i'm always looking at improving when and where ever … | |
from PySide import QtCore,QtGui import sys class ToolBarUI(QtGui.QMainWindow): def __init__(self,*args,**kwargs): super(ToolBarUI,self).__init__(*args,**kwargs) self.floatingToolBar() pass def buttons(self): self.btnVLay=QtGui.QVBoxLayout() self.incSavbtn=QtGui.QPushButton("Save") self.emailbtn=QtGui.QPushButton("Email") self.upldbtn=QtGui.QPushButton("Upload") self.setPrjbtn=QtGui.QPushButton("Set Project") self.setThumb=QtGui.QPushButton("Set thumb") self.shwMatbtn=QtGui.QPushButton("Show Material") self.fixtexbtn=QtGui.QPushButton("Fix Texture Paths") btns = [self.incSavbtn,self.emailbtn,self.upldbtn,self.setPrjbtn,self.setPrjbtn,self.setThumb,self.shwMatbtn,self.fixtexbtn] [self.btnVLay.addWidget(each) for each in btns] def floatingToolBar(self): self.buttons() self.setLayout(self.btnVLay) self.show() pass if __name__ =='__main__': app = QtGui.QApplication(sys.argv) app.setStyle("cleanlooks") win … | |
I need to program a way of storing and deleting multiple objects so that they stay around even after the program has been closed and that when you re-start the program you can search for an object? I'am using python 3.0 not 2.7. i.e. I create A class with different … | |
I want to delete An Xml Element book for authors matching J K. Rowling. My code below file1 = File("C:\\books.xml") docFactory = DocumentBuilderFactory.newInstance() docBuilder = docFactory.newDocumentBuilder() doc = docBuilder.parse(file1) list = doc.getElementsByTagName("*") for i in range(list.getLength()): node = list.item(i) #print node.getNodeName() if node.getNodeName() == "book": children = node.getChildNodes() for j … | |
what I wanna perhaps like this: when a right mouse button is pressed and we go down and right with a cursor. As in letter 'L'. Our mouse gesture will close the window. I googled such gesture examples on PyQt4 ,but hard to find one ,so your help will be … | |
A Python code example to find an approximate value for x in f(x) = 0 using Newton's method. | |
Explore Python's sqlite3 database module, create, write and read a database file. | |
This snippet shows you how to create a list of class instances. The class itself cannot be pickled, but the list of instances can. To use the pickled data file in another program, you have to recode the class in that program. | |
My code has a couple of "multiple assigments" and somehow I think there should be a nicer way to do this in Python. This is how it currently looks like: # sum price fields paf = paf + float(pa) pbf = pbf + float(pb) pcf = pcf + float(pc) pdf … | |
Jython is a version of Python that can use the extensive Java library. Jython uses Python syntax and avoids the rather ugly syntax (at least for Pythonions) of Java. Here we apply it to bring up an image from a file. | |
Why does the function *def human_move(board, human)* need to receive board *and* human? won't it work the same if it just receives board? *def human_move(board)* # global constants X = "X" O = "O" EMPTY = " " TIE = "TIE" NUM_SQUARES = 9 def display_instruct(): """ Display game instructions. … | |
I was experimenting with special methods, so I tried to create my own `__new__` method , well just as expected it got called when the object was instantiated but the window that should show up didnt show even when i used super to retain the original `__new__ `functionality. from PySide.QtCore … | |
At first, I have "C:/test02.txt" too good positive a film for stunt scheduling i think objective My codes with open('C:/test01.txt') as words: ws = words.read().splitlines() with open('C:/test02.txt') as file_modify4: for x in file_modify4: sx = map(str.strip, x.split("\t")) ssx = sx[0].split(" ") ## list for w in ssx: if w in … | |
why their is a difference between os.getenv('PATH') and sys.path ? | |
I have a web app in python but I'd like to protect it with site minder authentication. Thanks. | |
Hi Guys, Please be gentle with me as im a complete n00b. My favorite language is actually Java which im learning at Uni at the moment. However to throw a spanner in the works they have switched us over to Python, as well as learning Java. My mind has been … | |
When I try to save a pylab plot (either from the GUI or with `pylab.savefig`), I get the error at the bottom. A minimal script that demonstrates the problem is: import pylab pylab.savefig("foo.png") A Google search for `IndexError: Unexpected SeqBase<T> length` did produce some results, none of them hinting how … | |
I've created this script that logs in to Windows Live (http://login.live.com/) but I can't tell if it works, can anyone elaborate? import requests import sys EMAIL = 'email goes here' PASSWORD = 'pass goes here' URL = 'https://login.live.com/' def main(): # Start a session so we can have persistant cookies … | |
import requests import sys EMAIL = 'YOUR EMAIL GOES HERE' PASSWORD = 'YOUR PASSWORD GOES HERE' URL = 'https://login.live.com/' def main(): # Start a session so we can have persistant cookies session = requests.Session() # This is the form data that the page sends when logging in login_data = { … | |
![Spatial_Recall_2](/attachments/large/4/Spatial_Recall_2.png "Spatial_Recall_2") I'm new to pygame and currently I'm working on creating a memory game where the computer displays boxes at random positions for like a second and then the user has to click on where he/she thinks those boxes are. It's kind of like this: [Click Here](http://www.lumosity.com/brain-games/memory-games/memory-matrix) However right … |
The End.