15,181 Topics

Member Avatar for
Member Avatar for abcdr

I need to write a function that takes a string as an argument and outputs the letters backward, one per line.so far I have this: [code] def wordReverse(word): acum = "" for ch in word: acum = ch + acum return acum [/code] I tried adding \n to acum but …

Member Avatar for TrustyTony
0
176
Member Avatar for kate2mba

Hi all its me needing help again :P My exercise says: Write a function wordPop that accepts a text and a length N and returns the list of all the words that are N letters long, sorted by their length. okay so what I have is 2 fuctions first: [CODE]def …

Member Avatar for kate2mba
0
184
Member Avatar for juzzy

hi, im trying to do something like the following: text_area = wx.TextCtrl(self.panel, -1, style=wx.MULTILINE) a = (all the text in the text control window) I can't get my head around how to define the text with wxpython, how should I go about this?

Member Avatar for vegaseat
0
136
Member Avatar for Genre

Hello. I am just starting to learn Python, but I have some basic programming and web coding background. As my first real Python project, I want to come up with something that manages some basic content on HTML pages. Specifically, I want to come up with a way that I …

Member Avatar for TrustyTony
0
96
Member Avatar for need help!

I use windows-xp python 2.6 Could I have your help. I need to hide and then show a Tkinter root window. And also "remove" the exit, minimize and maximize options. I can't do it like this! root.hide() #do some stuff root.show() Root.hide works but root.show doesn't. No Exception thrown. :(

Member Avatar for hayathms
0
11K
Member Avatar for abcdr

I am trying to square each number in the list under [I]nums[/I]. But I don't know how to do it. I got this so far: [code] def squareEach(nums): for i in nums: y=i*i return y [/code] What is happening here is it's counting how many numbers are in the list …

Member Avatar for TrustyTony
0
448
Member Avatar for DawnyB

For my intro to programming class i have to design a game where a ball is shot at an angle and hits squares that are worth points. I have two questions 1.How do you get the ball to move. I was given this code but I don't know if I …

Member Avatar for Archenemie
0
1K
Member Avatar for timrichardson

I have a script where I want to use a message box for the occasional interactive question [code] # python 3.1 from tkinter import * from tkinter import ttk from tkinter import messagebox answer = messagebox.askyesno(message="Are you thinking of the " + "data " + "?" ,icon='question' ,title="My guess" [/code] …

Member Avatar for vegaseat
0
1K
Member Avatar for vulcano224

Hi Everyone, I need to create a quiz game similar to “Who Wants to be a Millionaire?” in PYTHON by using a graphical user interface (GUI), but I am not sure how to do it. Can anybody please help me?Any help would be greatly appreciated!!!!Thanks a lot!!!!!

Member Avatar for Archenemie
0
200
Member Avatar for Tommymac501

I'd like to post some code of an app I wrote to spit out large files, and sort them, and finally reassemble them. I'm new to Python, and the 'object' way in general. If you feel like it, would you please tell me how it should have been written 'properly'. …

Member Avatar for Gribouillis
0
170
Member Avatar for Tommymac501

I have the statement [CODE]fn = sys.argv[1] [/CODE] catching the filename at the command line when the user starts my program. The problem comes when a user uses a path with a space in it such as; 'C:\Documents and Settings\user\My Documents'. The argument parser sees ''C:\Documents' as the first paramenter, …

Member Avatar for Tommymac501
0
132
Member Avatar for aot

Okay, now that I consider myself to have decently mastered Python/Tkinter (or at least I'm no longer a complete noob), I'm turning my attention to the web. I'd love to be able to program applications that can be run easily via web sites (especially quick experiments). The easiest thing for …

Member Avatar for aot
0
223
Member Avatar for koffrig

I am trying to implement the game of life in a Tkinter GUI with python. Here is an example of what I am trying to achieve: [url]http://www.math.com/students/wonders/life/life.html[/url] (the java applet in particular) The question is quite basic, just as my background in python and programming in general. The effect that …

Member Avatar for TrustyTony
0
158
Member Avatar for wolfeater017

I have python 3.0 and im trying to get this code to work but I don't believe it is recognizing all the attributes it's supposed to. [CODE]import pygame, sys, random from pygame.locals import * #*******************************************SETUPVAR************************************************** BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) …

Member Avatar for wolfeater017
0
289
Member Avatar for Savok

I have 2 separate databases and I need to synchronize them (combine). One database is permanent the second one is updated every day. First I need to check the for a new entrances and print them out then I need to combine those two databases based on 1 key . …

0
29
Member Avatar for dekepler

I'm trying to print a (or many) large aerial photos converted from tiff's to jpeg's and cannot seem to get it done without a MemoryError message. These files are between 6 and 15 mb is size. These images are 9x9 photos with these dimensions: Width = 11705 Height = 11712 …

Member Avatar for Tommymac501
0
977
Member Avatar for bpatt22

If I want to find the X coordinate of an image that's already on a canvas, how would I do that with tkinter?

Member Avatar for bpatt22
0
470
Member Avatar for acrocephalus

Hello! I have created a database named Ornithobase, which contains a Users table with Name, FamilyName, eMail and Username columns. I have already connected to the database with MySQLdb module. How can I print this table in the console from the Python script? Furthermore, how can I perform a search …

Member Avatar for acrocephalus
0
122
Member Avatar for pxalpine

I have a script here that takes a bunch of diff .txt files and plugs&chugs what's in one file into a master "template.txt" list. It basically replaces what's in the [BRACKETS] in the master template list with the other data files. Here's my code: [CODE] import re, sys class Template: …

Member Avatar for woooee
0
108
Member Avatar for Tommymac501

This code worked fine under 2.6: [CODE]f = open("v20100515.csv",'rt') r = csv.reader(f) try: r.next() # skip the header record for row in r: n = 1 for col in row: print str(n) + ": " + col n += 1 ......[/CODE] But since I upgraded to 3.1, I modified it …

Member Avatar for Tommymac501
0
2K
Member Avatar for kate2mba

Hello all I am very very new to programming & Python. My problem is I cannot figure out how to create a line consisting of random colored pixels. I know how to create a white or red line but how to make the colors random is beyond me. This is …

Member Avatar for Beat_Slayer
0
111
Member Avatar for java_programmer

Hi, I have just started to learn python. I have installed and set the environment variables as per documentation. And from command prompt, I execute some python script,too. But I can't execute multiple line script, if the script contains any function. For example, see the following code - >>>a,b=0,1 >>>print …

Member Avatar for TrustyTony
0
359
Member Avatar for prodigenius

If this is my np array: [ [ 1 2 3 4 ] [ 5 6 7 8 ] [ 9 0 1 2 ] ] I want to turn it into: [ [ 4 3 2 1 ] [ 8 7 6 5 ] [ 2 1 9 0 …

0
55
Member Avatar for acrocephalus

Hello! I have this funtion to delete a record from a MySQL table: [CODE]def delUser(): #Delete user #Ask for user to delete Username = raw_input('Which user would you like to delete? ') #Delete user delUser = '''DELETE FROM Users WHERE Username = %s''' cursor.execute(delUser,(Username)) db.commit()[/CODE] The problem is that it …

Member Avatar for gunbuster363
0
114
Member Avatar for Archenemie

I have recently tried installing cherrypy to no avail, and it got me wondering, is there a way to build websites using the wxpython toolkit? if somebody knows the answer and could point me in the right direction it would be a massive help

Member Avatar for ryuurei
0
100
Member Avatar for Tommymac501

Ok, back to differences between 2.x and 3.x... I have the following code to convert the sort key to a float: [CODE]def sort_key_func(row): return float(row[76][0:5]) [/CODE] which (under 2.x) returned the value of the field in the current row in position 76 for a lengthof 5. It was called like …

Member Avatar for Tommymac501
0
96
Member Avatar for rahul8590

Well i have a small code snippet which is a basic http server. Well its running fine , but i am unable to catch the feedback and store it in a log file of my own for further analysis. code snippet : [URL="http://codepad.org/MppnYU9n"]http://codepad.org/MppnYU9n[/URL] just in case wondering on how to …

0
105
Member Avatar for newtri13

[CODE]I want to download attachments from email and search through them for a string of characters such as http://. The attachments will be in many formats, .doc, .html, .pdf. I am unfamiliar with mime and wanted to know if there is a way i can parse through the mime to …

Member Avatar for TrustyTony
0
113
Member Avatar for obscurecoder

I recently tried to run some scripts in Python on my .db file, but whenever I try to establish a connection, I get the following error: [code = python] >>> conn = sqlite3.connect('C:\Users\1545User\Documents\SEETA\ShruthLaikh\dict2. db', isolation_level=None) Traceback (most recent call last): File "<stdin>", line 1, in <module> sqlite3.OperationalError: unable to open …

Member Avatar for TrustyTony
0
71
Member Avatar for bettersaid

i want explore the use of PIL but my first try got me this error : ImportError: " No module named ImageGrab " i tried it in terminal by typing 'python -v', 'import Image' but im broke. please help! thanks[CODE] import ImageGrab capture=ImageGrab.grab() capture.save('screen.png')[/CODE]

Member Avatar for TrustyTony
0
141

The End.