15,181 Topics

Member Avatar for
Member Avatar for clouds_n_things

So, I wrote an address book and I'm nearly done, but Im having a little trouble using the picle module to back up the input data to a file for later retrieval. Here is what I have so far: (Im working on a solution while I type this) from tkinter …

Member Avatar for clouds_n_things
0
318
Member Avatar for fheppell

I need to build a gift voucher section of my python cash register software Here's the code I have so far elif payment == '3': print "Scan or enter gift card" cardno = raw_input('Card Number: ') try: with open(cardno, '.txt') as f: pass value = f.readline() except IOError as e: …

Member Avatar for Lucaci Andrew
0
159
Member Avatar for vegaseat

A colorful look at the PySide GUI toolkit and its QPainter class and methods. Well commented and demonstrated with the drawing of a number of rectangles and the different ways to apply colors.

1
1K
Member Avatar for rev_ollie

Hi, I am coding some python to work with some wireless serial devices. I have 2 devices reading temperatures and other environmental data over an Xbee which then writes the data over serial. The data looks like this when read in Hex: *7e001090007d33a200408b2e0c2db7010016005763* The important character is the 7e at …

Member Avatar for rev_ollie
0
4K
Member Avatar for sudipta.mml

Suppose my long sequence looks like, 5’-AGGGTTTCCC*TGACCT*TCACTGC*AGGTCA*TGCA-3 The two italics subsequences (here within the two stars) in this long sequence are combinedly called as inverted repeat pattern. The length and the combination of the four letters such as A,T,G,C in those two subsequences will be varying. But there is a …

Member Avatar for TrustyTony
0
468
Member Avatar for clouds_n_things

Hello everyone! I am tring to use Tkinter from terminal (I'm on a mac) and I keep raising AttributeErrors on both Python 2.7 and Python 3. For 2.7 I input: >>> from Tkinter import * >>>win = Tk() >>>f = Frame(win) >>b1 = Button(f, "One") and I raise the AttributeError: …

Member Avatar for clouds_n_things
0
3K
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
249
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
709
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

The End.