15,181 Topics
| |
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 … | |
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: … | |
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. | |
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 … | |
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 … | |
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: … | |
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 ? |
The End.