15,175 Topics

Member Avatar for
Member Avatar for pmec

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 …

Member Avatar for ZZucker
0
5K
Member Avatar for heavy.is.happy

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 …

Member Avatar for Lardmeister
-1
2K
Member Avatar for chophouse

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 …

Member Avatar for chophouse
0
626
Member Avatar for dashing.adamhughes

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 …

Member Avatar for dashing.adamhughes
0
355
Member Avatar for clouds_n_things

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?

Member Avatar for clouds_n_things
0
186
Member Avatar for dr_robert

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 …

Member Avatar for dr_robert
0
1K
Member Avatar for Valosar

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 …

Member Avatar for Valosar
0
203
Member Avatar for SumTingWong59
Member Avatar for TrustyTony
0
136
Member Avatar for z.n11

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 …

Member Avatar for TrustyTony
0
101
Member Avatar for pars99

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 …

Member Avatar for vegaseat
0
275
Member Avatar for bulleh

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 …

Member Avatar for bulleh
0
248
Member Avatar for krystosan

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 …

Member Avatar for krystosan
0
1K
Member Avatar for lukecalland

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 …

Member Avatar for vegaseat
0
165
Member Avatar for vasu1486

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 …

0
36
Member Avatar for chao.lee.927

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 …

Member Avatar for Gribouillis
0
202
Member Avatar for vegaseat
Member Avatar for dashing.adamhughes
2
7K
Member Avatar for vegaseat
3
343
Member Avatar for vegaseat

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.

3
2K
Member Avatar for biscayne

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 …

Member Avatar for biscayne
0
248
Member Avatar for vegaseat

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.

4
707
Member Avatar for smitmail22

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. …

Member Avatar for smitmail22
0
206
Member Avatar for krystosan

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 …

0
63
Member Avatar for thanadaray

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 …

Member Avatar for Lucaci Andrew
0
129
Member Avatar for krystosan
Member Avatar for Ron12345

I have a web app in python but I'd like to protect it with site minder authentication. Thanks.

0
112
Member Avatar for woooee

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 …

Member Avatar for Lardmeister
1
171
Member Avatar for ronbarak

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 …

0
146
Member Avatar for GGreek

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 …

0
113
Member Avatar for GGreek

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 = { …

0
49
Member Avatar for nnekymoe

![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 …

0
163

The End.