15,175 Topics
| |
A little fun drawing with the Python module turtle. Well commented to help the beginner. | |
I mainly need help with creating the 3 by 4 matrix (part 3 of the assignment) as i am confused as how i would create it. However this is the entire assignment: 1. Write a function that returns the sum of all the elements in a specified column in a … | |
I am reading the book for web2py. It is running through some python syntax examples. When I ge to this closure example I am not understanding how 'y' gets its value. This is the code. >>> def f(x): def g(y): return x * y return g >>> doubler = f(2) … | |
Hello, I have got [this](http://www.yasinuludag.com/darkorange.stylesheet) a Qt stylesheet, how do I load it to my PyQt module after creating a QString Object. if I do from PyQt4 import QtCore s = QtCore.QString('c:\myProject\darkFantasy.stylesheet') the above code loads the path string rather than the actual stylesheet. So how do I load the … | |
#McListBox Example #Jan.20, 2013 import tkinter as tk import tkinter.font as tkFont import tkinter.ttk as ttk #import re Actors_list = [("Rowan","Atkinson"),("John","Candy"),("Morgan","Freeman"),("James","Garner"),("Cary","Grant"),("Kate","Hudson"), ("Jack","Nicholson"),("William","Powell"),("Arnold","Schwarzenegger"),("Tom","Selleck"),("John","Wayne")] Movies_list = [[("Bean","1997"),("Mr. Bean's Holiday","2007"),("The Lion King","1994"),("Johnny English","2003"),("Johnny English Reborn","2011"),("Keeping Mum","2005"),("The Black Adder","1982-1983")], [("Dr. Zonk and the Zunkins","1974"),("Tunnel Vision","1976"),("SCTV","1976-1979"),("1941","1979")], [("The Pawnbroker","1964"),("Blade","1973"),("The Electric Company","1971-1977"),("Attica","1980"), ("Brubaker","1980"),("Street Smart","1980"),("Driving Miss Daisy","1989"),("Glory","1989"),("Unforgiven","1992"), ("Outbreak","1995"),("Se7en","1995"),("Amistad","1997"),("The … | |
Im new to python and im runnung xubuntu! I was wondering if there is a site that does tutorials for Python in xubuntu?? | |
Hi everybody, is there anyone with experience with opencv for python? I was wondering if there is a way to allocate some memory on demand, since when I try processing images (usually bigger than 800x800 pixels) I get a "OpenCV Error: Insufficient memory (unable to allocate 59500564 bytes)" message. (bytes … | |
Hi guys, I have a code that intercepts calls to methods via __getattr__. Something like: def __getattr__(self, attr, *fcnargs, **fcnkwargs): out=getattr(self._df, attr)(*fcnargs, **fcnkwargs) etc... My goal is when a user calls a method, if it is not a method of self, the program attempts to run it on one of … | |
I'm fairly new to python. I've been using a modified verson of McListBox from a posting by vegaseat to get 2 treeviews going. It's been working well until I've been trying to be able to click on one to select what will be shown in the second. Anybody have an … | |
I'm trying to create a little text module for pygame. I've got everything up and running but I can't seem to get list.pop() to work. Whenever a person presses a key I put the chr() version of it into a list, then I iterate over that list to print out … | |
Nevermind, fixed it, I was being stupid. | |
Hey Guys i have a list like ['10015, John, Smith, 2, 3.01', '10334, Jane, Roberts, 4, 3.81' , '10208, Patrick, Green, 1, 3.95'] i need to split this list and create a list of this form 10015 John Smith 2 3.01 10334 Jane Roberts 4 3.81 any ideas how to … | |
hello im a hobbyist who is somewhat new to c++ with lots of experience in python. in python i was able to use dictionaries that could be accessed by keys and values with no limits on data types that can be stored but now im trying to port a simple … | |
# "toNumbers(strList) is a list of things,each of which represents a number.Modifies each entry in the list by converting it to a number." # Here is my code and it won't work,please help,thank you! import string def toNumbers(strList): nums = [] for i in strList: nums = nums.append(int(i)) return nums … | |
If you draw shapes that are closely spaced and shifted, you can create interesting interference patterns, so called moire patterns. Here is an example using the Python module PyGame to do the drawing. | |
Hi, I want to perform a search with Python in this site: [url]http://www.draftexpress.com/search.php[/url] I want to search for a player who's first name is "james". The problem: The page with the result's url is: [url]http://www.draftexpress.com/search.php#results[/url] Obviously, when opening this page directly, I don't get the page with the results for … | |
hello everyone i created a python file DailyExpensessave.py when i need to import this in another python program i was getting this error > Traceback (most recent call last): > File "C:\Python32\DailyExpensessave", line 1, in <module> > from DailyExpenses import * > ImportError: No module named DailyExpenses Both the python … | |
Dear friends, is there a way to execute a dos command in a frame inside a wx.window GUI (and not in the usual external window)? Thanks | |
This small code example shows you how to approach the beginning concept of an very simple "IDE" for Python. | |
having a little trouble trying to convert this pseudo code into python, could any help receiveFile () { lastblock := 0 newblock := 0 ; repeat repeat event := getFrameFromUDP(m) ; case event of data : newblock := getBlockNoFromFrame(m) ; transmitAckOverUDP(newblock) | timeout: transmitAckOverUDP(lastblock) esac until newblock==lastblock+1 ; lastblock = … | |
I have implemented a toolbar that has several QPushButtons inside QVBoxLayout, however I have implemented it in `toolbar_UI.py` from PySide import QtCore,QtGui class ToolBarUI(QtGui.QWidget): def __init__(self,*args,**kwargs): super(ToolBarUI,self).__init__(*args,**kwargs) self.floatingToolBar() def sizeHint(self): return QtCore.QSize(65,45) def buttons(self): self.emlSel = QtGui.QAction("Email Selected", self) self.emlScn = QtGui.QAction("Email this Scene", self) self.emlBufr = QtGui.QAction("Email Current Frame … | |
If you want a window with a menubar, toolbar, statusbar, dock and central widgets, you can use the PySide GUI toolkit's QMainWindow. To use the more traditional box and grid layouts, you simply add a QWidget instance as the central widget. Here is an example. | |
Hi all, I want to combine multiple files those are kept in a directory. Before getting the big file, I want to edit first and then combine them. For example, I have two files such as file1 and file2 in a directory, say TEST file1 contains 1 C 8.95377612903e-07 2 … | |
Here is code, which you can play with before installing and using the [superior blist package from pypi](http://pypi.python.org/pypi/blist/). I did it as therapy after doing programming test answer using zillion of setters and getters. Motivation is basically to show why you should use properties after you need them and attribute … | |
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: … |
The End.