15,175 Topics
| |
Hi, I am new to python but learned somewhat about lists, tuples, dictionaries, db and gui (just introductory stuffs), and am trying to write a program that will alllow users to input some key words to search in a report. if key words are present in the report then the … | |
This is some code I wrote for a music program... Any way on making it neater/more pythonic? [CODE] from Tkinter import * import pygame playlist=[] pygame.init() pygame.mixer.init() camera=pygame.mixer.Sound("E:\\Peter\\Python_stuff\\data\\Music\\camera1.wav") one=pygame.mixer.Sound("E:\\Peter\\Python_stuff\\data\\Music\\one.wav") wrong=pygame.mixer.Sound("E:\\Peter\\Python_stuff\\data\\Music\\wrong.wav") root=Tk() root.title("DJ Pro") def sound_play(event=None): playlist.append(wrong) wrong.play() def sound_play1(event=None): playlist.append(one) one.play() def sound_play2(event=None): playlist.append(camera) camera.play() def play_all(event=None): for ii in … | |
i am trying to make a password system that will run another one of my programs when answered correctly. not sure how to call my main program in the password prog function. i have played w this over and over, and browsed the library and i am officially stuck. :) … | |
The American Heart Association (AHA) suggests that at most 30% of the calories in our diet come from fat. Although food labels give the number of calories and the amount of fat per serving, they often do not give the percentage of calories from fat. This percentage can be calculated … | |
Can someone help please! I need to search for a different set of strings like: 'fummy' or 'users' or 'logon' from a directory like this: C:\mycase\Nic..\ A Text document is stored in there LIKE: 544, Text Document, 45, 588 KB Can some help to write a script or python program … | |
I cant get text working in my programs if I double click the icons in windows but it does work in the WinEditor. Why doesnt it work and what could I do to get text working wherever? | |
First let me say I know absolutely nothing about Python. All I know for sure is that I own the PC game Vampire Bloodlines and I am getting a runtime error. I have researched online and have read that if you have an older version of Python the game will … | |
Hello I an new to python I want to write a function which save the contents to disk I am using GTK also to design . On clicking the save menu item the output should be able to saved at any desired location {on_save_activate()}. Please help me to write the … | |
Hello fellow python programmers. I had an idea the other night when watching a video on the creation of the Tasque application. Developers at novel are given a week called "Hack week" were they have no management and are allowed to code anything they like. Well two of the developers … | |
I am making a game using pygame and livewires. I am having trouble with the scoreboard- it updates appropriately but does not delete the old scoreboard, thus creating a blob of numbers: [CODE]class Ship(games.Sprite): """Ship, represents the player""" image = games.load_image("ship.bmp") DELAY = 25 def __init__(self, x, y): super(Ship, self).__init__(image … | |
hello, I've wrote this calculator [code=python] from __future__ import division class num: x = input ("Input first number:\n") numb = num() class wtd:#wtd= what to do command = raw_input("What do you want to do?\nadd +\nsubstract -\ndivide /\nmultiply *\n") cmd1 = wtd() bull1 = cmd1.command while cmd1.command != "+" and cmd1.command … | |
In the following program, why is [COLOR="red"]"Ac"[/COLOR] the first thing that the program outputs? In main, [COLOR="red"]print "Printing a Card Object"[/COLOR] is the first think I see that should print anything. Is it the [COLOR="red"]__str__[/COLOR] method using the rank & suit attributes from the [COLOR="red"]__init__[/COLOR] constructor? [CODE]# Playing Cards # … | |
this is my code: [CODE]import os,sys import random import webbrowser import time import subprocess as sp cls=os.system("cls") title=os.system('title Hit any key to start searhing!') while True: cls print "" title raw_input() getRandEntry() def getRandEntry(): theFile = open("wordlist.txt","r") wordList = theFile.readlines() theRandoms = [] theRandoms.append(random.choice(wordList)) * 4 startLink(theRandoms) return theRandoms def … | |
Hi, I am still very new to python and programming so could anyone help me on how to input lines from a user, one line at a time until they type "." on a separate line. I also wanted to count how many lines they entered. What I tried was … | |
hey folks, i'm trying myself on a csv based adressbook but I get the following error: [CODE] Traceback (most recent call last): File "C:\Dokumente und Einstellungen\Mo\Desktop\adressbook.py", line 11, in <module> writer.writerows(data) File "C:\Python26\lib\csv.py", line 149, in writerows rows.append(self._dict_to_list(rowdict)) File "C:\Python26\lib\csv.py", line 140, in _dict_to_list ", ".join(wrong_fields)) ValueError: dict contains fields … | |
I'm having difficulties parsing filepaths sent as arguments: If I type: [code]os.path.normpath('D:\Data2\090925')[/code] I get [code]'D:\\Data2\x0090925'[/code] 0bviously the \0 in the folder name is upsetting the formatting. I can correct it with the following: [code]os.path.normpath(r'D:\Data2\090925')[/code] which gives [code]'D:\\Data2\\090925'[/code] My problem is, how do I achieve the same result with sys.argv, namely: … | |
Hi, I'm trying to get a list of the subjects that I'm getting from emails in gmail. I can get the subjects, but I can't seem to get them into a list. Here's my code so far: [CODE] #! usr/bin/env python import imaplib M=imaplib.IMAP4_SSL('imap.gmail.com', 993) M.login('user@gmail.com','password') M.select() typ, emails = … | |
I need the function to be able to walk in all four directions with equal probabbility and return the distance away from the starting point. The function below only takes steps forwards and backwards? [code] def main(): numWalks, numSteps = getInputs() averageSteps = takeWalks(numWalks, numSteps) printExpectedDistance(averageSteps) def getInputs(): numWalks = … | |
hi guys is there a way to refer to every 2nd symbol of a string? example: [CODE] mystring = 'bananasplit' [/CODE] i want to refer to every 2nd and every 3rd symbol of any string the user types in. in this case the 1st symbol is 'b', the 2nd is … | |
Hi, Iam new in python (1/2year) and here is the thing: I made a small text editor with tkinter and I want to generate web page from the text editor (from formated text). To web page generating I will use the HTMLgen module. So it must be created another python … | |
I wrote a gui with qt and converted it into python.it came below. know I want to use the information witch user entered.for example the text boxes text or want decide around the buttons clicked or any thing else.at all how can i manage my qt forms data in my … | |
Hay, I am a noob, to the programing world, so i need a little help with lists. My problem is; I would like to create a list that contains the percent that each number of the first list is of sum of the firs list list. so like this. [CODE]first_list=[1,2,3,4,5] … | |
Im trying to create a python program capable of solving a maze. I need it to be able to solve a maze that is any number of rows in height and any number of columns in width. I need the maze itself to be brought in as input from a … | |
This program is supposed to add, subtract, multiply, and divide complex numbers and doubles as well as complex numbers against complex numbers. When i try to run it, I get a syntax error at line 59 and cannot figure out why. Any help/advice/pointers would be greatly appreciated. [CODE]class complex: def … | |
Hi. I'm a retired computer programmer learning Python to use with my graduate studies in cognitive science and artificial intelligence. Specifically I am looking for the application of Python in Natural Language Processing, per the Natural Language Tool Kit, per [url]http://www.nltk.org/download[/url] I'll be taking a course in Natural Language Processing … | |
Hi I am new to this forum so please excuse me if am not following the etiquette. I am a beginner in wxpython. For a project I need to create a color palette. Please check and tell me what I am doing wrong. Any help,suggestion,code snippet is welcome. [code] import … | |
Does anyone know where I can find some sort of UML (unified modeling language) tool for python? I think it might help me understand OOP a little better, but I don't really know, I just read about UML and that's all I know. Thanks. | |
I've been trying to read up about how tkinter (or more accurately Tk) works on windows AND linux. Here's what I've understood so far. Tk is a predefined set of widgets. That is stuff like text boxes, check boxes, drop down lists etc. Tkinter is just a way of translating … | |
I have the following code: but for some reason it just won't work if I touch the i the query self works, cause if I just do .Append(str(i)) without the split strip it returns all the tables.. [code=python] def mysql_table(self): self.list_box_3.Set([]) try: self.cursor.execute("SHOW TABLES;") self.query = self.cursor.fetchall() except: self.log("error") for … | |
I have been contemplating on what would be best, when it comes to learning. What I mean by that is, I have a certain job. The goal in that job is to learn python, because the job uses python django and a few other languages to complete websites. I do … |
The End.