15,181 Topics
| |
So I'm writing a code that imports pygame to play files of music notes. I set each note to a button, 24 notes for 24 buttons. However, the program will also have four more buttons: "Record", "Stop", "Playback", and "Quit". when the record button is clicked, it will append the … | |
how i can set a header and footer when printing a QTextDocument in pyqt4 ? | |
[CODE]from time import sleep import win32com.client as win32 RANGE = range(3, 8) def word(): word = win32.gencache.EnsureDispatch('Word.Application') doc = word.Documents.Add() word.Visible = True sleep(1) rng = doc.Range(0,0) rng.InsertAfter('Hacking Word with Python\r\n\r\n') sleep(1) for i in RANGE: rng.InsertAfter('Line %d\r\n' % i) sleep(1) rng.InsertAfter("\r\nPython rules!\r\n") doc.Close(False) word.Application.Quit() if __name__ == '__main__': word() … | |
| I am trying to create a walker that goes through directories. Here are the inputs and outputs which I have partly working. I am using a test directory but I would like this to be done on any directory which is leading to some problems. [CODE][IN]: print testdir #name of … |
hell everyone,i am ruuning a program from headfirst programming using pygem.....my pygem is installed in this location -------> [B][COLOR="Red"]C:\Python32\Lib\Lib\site-packages\pygame[/COLOR][/B] now my piece of code is: [B]from tkinter import * import pygame.mixer app = Tk() app.title("Head First Mix") app.geometry('250x100+200+100') sound_file = "Sototar Bilasita.wav" mixer = pygame.mixer mixer.init() def track_start(): track.play(loops = … | |
Hi. I'm creating an interface using the Tkinter library, but I seem to be having some issues with placing 3 buttons BELOW 3 buttons which are on top. All buttons should be inside the second LabelFrame. I've looked all over and I can't seem to figure out why the other … | |
Hello everybody I'm trying to use Python and Django to make my first website , i followed this tutorial : [URL="http://webpy.org/docs/0.3/tutorial"]http://webpy.org/docs/0.3/tutorial[/URL] , and i could finaly while the execution of the Python code nouveau_fichier.py which is : [CODE]#! /usr/bin/python # -*- coding: utf-8 -*- import web urls = ( '/(.*)', … | |
hello friends As the tittle say , i just would like to know if there is possibilities to change the graphisme of the Button : color , form , insert image on the Button ... , Thank you for answering , good luck :) . | |
hello friends , I just don't know , why in using Crontab it don't execute a code python that contain : [CODE]execfile("Backup1.py")[/CODE] my code is nouveau_fichier2.py : [CODE]#!/usr/bin/python #-*- coding:Utf-8-*- # -*- coding: cp1252 -*- import os print 'helo' #os.system("sudo chmod 777 /home/ismail/Bureau/Test/20111214") execfile("Backup1.py")[/CODE] and my crontab file after "crontab … | |
I am having trouble parsing xml files using ElementTree after the python code is turned into .exe using cx_freeze. [CODE] from xml.etree import ElementTree file1 = 'file1' file2 = 'file2' tree1 = ElementTree.parse(file1) tree2 = ElementTree.parse(file2) print 'Done' [/CODE] It works fine with the .py file, but after I made … | |
What I'm trying to do is read a line from a file containing some data that includes a person's first and last name, their hourly wage and the number of hours they worked, and then writing to a seperate file their last name, first name: wage. The input file looks … | |
So, this seems like it should be the default to me... if you're going to make your own picture for a button, I don't see why you'd want the default border around it, but I can't for the life of me figure out how to get rid of it. I … | |
Beginner here (meaning I probably did something silly): I am trying to target indexed elements that have [A], in them. Entries for 'scarcity' and 'sweet' are both shown. I am running into trouble when index item[2] is empty. I get the following message: [code=text]['scarcity', 'scarce', '[A],', 'ity', '[N|A]', '[N]'] scarcity … | |
Hi, I need to extract some info from a file. This is two rows from what the file looks like: prob=0.0093;ID=RGT430;BQRS=491;BRZ=-4.263;ID2=RT914;DRT=0.00;HRun=0;HaplotypeScore=0.2794; prob=0.003;ID=RGR301;BQRS=4;BRZ=-3.261;ID2=EV913;DRT=0.00;HRun=0;HaplotypeScore=0.2654; ....etcetc until last row: prob=0.345. I want to extract prob from each row in the file and put it in a new file, but I don't know how … | |
Have you ever cited the Python documentation? How did you do it? I can't seem to find author names and such information. I've only ever cited books as well. I'm trying to find out who authored the 2.7.2 docs, and how to cite them properly, since I used it to … | |
[code] import urllib from urllib2 import urlopen from gzip import GzipFile from cStringIO import StringIO import re import urllib2 def download(url): s = urlopen(url).read() if s[:2] == '\x1f\x8b': # assume it's gzipped data with GzipFile(mode='rb', fileobj=StringIO(s)) as ifh: s = ifh.read() return s s = download('http://www.locationary.com/place/en/US/Virginia/Richmond-page20/?ACTION_TOKEN=NumericAction') findLoc = re.compile('http://www\.locationary\.com/place/en/US/Virginia/Richmond/.{1,100}\.jsp') findLocL … | |
Hi! I am trying to make a program that will put the bands I've played with in alphabetical order. I'm getting the band names from a file on my computer. I am fairly new to python and don't have much experience what so ever. I'll post the code that I … | |
Hi everyone! I joined these forums about a week ago so I could try and learn more about Python, and thankfully I can say that I have learned a bit. Enough to try and create a Mastermind game, although I'm having trouble with converting the code into Pygame and give … | |
I am getting this error PYTHON - TypeError: unsupported operand type(s) [CODE]weekPay = [] names = [] hours = [] wages = [] while True: name = raw_input("Please input yor first and last name or type \"Done\" to continue: ") if name.title() == "Done": break names.append(name.title()) hour = raw_input("Please input … | |
In my code they're instructed to enter a width and height. However obviously these will be intergers, but I need to perform checks that they are intergers before they're used. Atm I've got this: [CODE] while True: if width.isdigit() == True and height.isdigit() == True: if width >= 2 and … | |
Hi there, I'm writing my first Python script for a(n imperative) programming class at university, and I want to make it a little better. It's meant to be fairly short, 50 lines. I've written the basic 'mechanism' to look at the user input. Instead of simply printing every property of … | |
hi everyone,i am just a beginner in python,i am going through "head first programming" and saw about the [B][COLOR="red"]pygem[/COLOR] [/B],but iam unable to install pygem....i already downloaded [B][COLOR="red"]pygame-1.9.1release.win32-py2.5[/COLOR][/B] from pygem site,but at the time of running the set up i am getting a error that it is not compatible with … | |
Hi friends! I need to make a function which takes a string, e.g: '(239..247),(467..765)' (corresponding to the coding area of DNA sequence) and return a list with a tuple for each coding part, each with a start and end value. e.g. [(239,247),(267,765)]. Someone has a clue how to start up? | |
Hi guys, I been working on a project that involves in managing a phone inventory for a company. So for this project we are to use classes. For the most part I got everything except two areas of code that I am having trouble with. I have two classes, Class … | |
Hi, I have data in the form: rpm Torque 1000 36 2000 40 3000 45 4000 50 . . I need to find the torque at a specific rpm. I found numpy.interp() which will give me a linear interpolation, but my tutor said it wouldn't be accurate enough. I found … | |
How do you get the name of a win32com.client.gencache.EnsureDispath name? For example, I have an application named "xxxxx", and the Python object browser detects it when I use makepy.py. How do I get name like "Excel.Application"? | |
[CODE]tomorse ={ 'A': '.-', 'a': '.-', 'B': '-...', 'b': '-...', 'C': '-.-.', 'c': '-.-.', 'D': '-..', 'd': '-..', 'E': '.', 'e': '.', 'F': '..-.', 'f': '..-.', 'G': '--.', 'g': '--.', 'H': '....', 'h': '....', 'I': '..', 'i': '..', 'J': '.---', 'j': '.---', 'K': '-.-', 'k': '-.-', 'L': '.-..', 'l': '.-..', … | |
Good day everyone, I need to print data using if-elif statement. I when I run this code like this, everything went well [CODE] if row['username'] == 'mutago': print " okay" sys.exit(0) else: print "wrong" [/CODE] OKAY now i want to include elseif statement to print another data but it returns … | |
Hey, So I am completely new to python, I was wondering if someone could assist me with this program I am trying to make, The idea is simple, a program that counts for the user. Asking the user to enter a starting number, ending number, and the amount to count … | |
Is their any way to make an exe from my python files other that py2exe as am getting some problem.And for the same is their any method for linux also. |
The End.