14,946 Topics

Member Avatar for
Member Avatar for noniterum03

I am having trouble with tkinter and python on my Mac, I'm running Leopard.I did a port install of python2.6, numpy, scipy, matplotlib, but when I try and import matplotlib.pyplot, I get the following error. I think there is a conflict with the pre-built version of python that comes with …

Member Avatar for woooee
0
156
Member Avatar for danholding

i am getting a ValueError message when running my code i am currently converting from 2 to 3 and have come across a brick wall any help would be great :) [code=python] # sorts files by modifed date, collects the 6 most recent files, and delete all others. #created by …

Member Avatar for woooee
0
409
Member Avatar for sebcbien

Hello, I'm trying to update a dictionary using variable in a class. Something looking like this : [code=python] class testClass(object): def __init__(self): self.data0 = 0 self.data1 = 1 self.data2 = 2 self.data3 = 3 self.d = dict( data0 = self.data0, data1 = self.data1, data2 = self.data2, data3 = self.data3 ) …

Member Avatar for snippsat
0
170
Member Avatar for viandante

I'm trying to make a siple list to display sqlite rows in a grid using wxList. I can't come up with something decent. I can't place correctly the items in the list. [code] #!/usr/bin/env python # -*- coding: utf-8 -*- # generated by wxGlade HG on Wed Sep 22 12:34:17 …

Member Avatar for viandante
0
133
Member Avatar for doffing81

Let's create a continuing thread to program Crazy 8's from scratch for learning purposes! [B]DECK/CARD IDEA'S[/B] My simple starting suggestion: [CODE]deck = ['2C','3C','4C','5C','6C','7C','8C','9C','10C','JC','QC','KC','AC', '2D','3D','4D','5D','6D','7D','8D','9D','10D','JD','QD','KD','AD', '2H','3H','4H','5H','6H','7H','8H','9H','10H','JH','QH','KH','AH', '2S','3S','4S','5S','6S','7S','8S','9S','10S','JS','QS','KS','AS',][/CODE]

Member Avatar for doffing81
0
1K
Member Avatar for Enders_Game

So I'm trying to make a parser for a game replay. I just need help getting started, I have docs for it explaining. Atm I'm just trying to get the header parsed. [code] replay = open(r'C:\Users\CookieMonster\Desktop\mix.w3g', 'rb') #offset | size | description print(replay.read(0x1c)) #0x0000 | 28 chars | zero terminated …

Member Avatar for griswolf
0
245
Member Avatar for slingblade

I've been trying to modify a function and every attempt seem to screw up the plist. [CODE]def removeItem(pl, item_name): for dock_item in pl['persistent-apps']: if dock_item['tile-data']['file-label'] == item_name: verboseOutput('found', item_name) pl['persistent-apps'].remove(dock_item) return True for dock_item in pl['persistent-others']: if dock_item['tile-data']['file-label'] == item_name: verboseOutput('found', item_name) pl['persistent-others'].remove(dock_item) return True return False [/CODE] This scans …

Member Avatar for slingblade
0
125
Member Avatar for PascalNouma

Hi everyone, Does anyone know how to remove a particular attribute in XML by using Python? [CODE] <country> <city capital="Paris">Paris</city> ............ ............ </country> <country> <city capital="Helsinki">Helsinki</city> ............ ............ </country> <country> <city capital="Bogota">Bogota</city> ............ ............ </country> [/CODE] I just wanna delete or remove Paris and Helsinki here by using SAX or …

Member Avatar for bvdet
0
320
Member Avatar for acrocephalus

Hello! I have a frame with some sizers in it (see code at th end for a running example). I would like to know how to repeat the sizers 2, 3 and 4 when pressing the add button. The sizers should be added before the submit button, and the control …

Member Avatar for acrocephalus
0
122
Member Avatar for emorjon2

hello! I'm coding in python and have make the computer controll a lego NXT robot via bluetooth. Next step is to involve my lg ku990 mobile to the network, so I can get the camera and sound information from the mobile phone. Do anyone knows a python library as allow …

0
161
Member Avatar for Archenemie

[CODE]paid_value = self.paidinput.GetValue().strip()[/CODE] I have this line of code to take a number from the paidinput field, but i need the value as an integer, how would i go about this?

Member Avatar for Archenemie
0
98
Member Avatar for AnnetteM

Hello Daniweb, I would like to read binary data into floating point numbers. I'd be happy with a 1-D array (or vector) or a 2-D array. Just something I can write to a text file. I attached a small sample of this data. Here is the code I have so …

Member Avatar for woooee
0
4K
Member Avatar for kadvar

Hi, Given a sentence, I'm trying to check if all the individual constituents of a word are present in it and if they are then do some further processing. I can't seem to get the logic to work. [CODE]wordlist = ['England area','Germanic 6th'] mysentence = 'The area now called England …

Member Avatar for kadvar
0
98
Member Avatar for Sandhya212

Hi, My requirement is to identify '-' in string1 and delete those corresponding locations in string2. The logic I am implementing is that 1. find the locations in string1 where '-' occurs 2. At these locations, insert spaces in string2 and then 3. have string2 without spaces. I managed to …

Member Avatar for TrustyTony
0
120
Member Avatar for kez1985

Hi I recently started using python for work and was tasked with creating a mailer script for one of our linux servers. I found a number of good examples on the web for different mailer app implementations and eventually came to the code below. Can anyone advise me on good …

Member Avatar for TrustyTony
0
192
Member Avatar for cmcpart0422

Hey I'm new to the site but I'm taking a class that will probably have me here often asking stupid questions. One of my homework problems is create a python program using a while loop to answer the 100 fowl problem. The 100 fowl problem is a farmer sold 100 …

Member Avatar for cmcpart0422
0
109
Member Avatar for Sandhya212

Dear all. I have a file with lines like this.[CODE] query 210 ACTTGGACTC 219 query 311 ACTTGGACTC 320 ....[/CODE] From every line, I need to extract the number coming right after 'query' and then the DNA sequence. I currently read each line as a list but was only able to …

Member Avatar for Sandhya212
0
161
Member Avatar for bettersaid

Is it possible in python to open all files in a directory? this only opens a particular file: [CODE]import os path = "/Desktop/directory/file.odt" temp = os.system("open " + path)[/CODE] how about this? am i doing it right? [CODE]import os mypath = "/Desktop/directory" temp = os.listdir(mypath) temp = [os.path.join(mypath, i) for …

Member Avatar for redyugi
0
127
Member Avatar for bettersaid

[CODE]import os from appscript import * this = app(u'System Events').application_processes[param1].windows[param2].exists() while True: this1 = app(u'System Events').application_processes[param1].windows[param2].count(each=k.radio_button) if count == (this1): this2 = app(u'System Events').application_processes[param1].windows[param2].radio_buttons[param3].click() try: os.makedirs(param1) except OSError: if os.path.exists(param1): this3 = os.system('screencapture -C '+ param1 +'/'+ param2) while True: self.param2 = os.path.join(param1, 'win%s_%s_img_%s' % (param1, param2)) return param2 + …

Member Avatar for bettersaid
0
186
Member Avatar for kimmi_baby

I've created a program with turtle graphics that has 3 functions. One draws rectangles, one draws squares and one sets the position. I'd like to create a function that fills in the shapes with different colours. I know about begin fill and end fill... but I would really like to …

Member Avatar for stevenpgrm
0
80
Member Avatar for bettersaid

f i opened a document in terminal through this [CODE]os.system("open " + pathName)[/CODE] how should i close it? is there something like [CODE]os.system("exit")[/CODE] or something Thanks

Member Avatar for bettersaid
0
75
Member Avatar for python_user

Hi Guys i have a situation where i need to have a options menu kind of thing. When they select some option in the menu i need to have a text-box/box which accepts only date/box which accepts only int beside it to accept the value I am trying to do …

0
54
Member Avatar for smittles

I am brand-new to Python, and this is my first post on DaniWeb. Seems like a positive community, and I hope one day to contribute as a knowledgable expert and not a world-class newbie. I'm wanting to create a simple python program that "fakes" Shakespeare or haiku-style output. I realize …

Member Avatar for TrustyTony
0
182
Member Avatar for ihatehippies

Is there a way to set an objects id or memory position? Ultimately I'm trying to change function "a" to function "b" while still preserving any saved reference to function "a"

Member Avatar for ihatehippies
0
162
Member Avatar for dustbunny000

Is there a logical operator in python for and/or of strings? I am trying to write a weasel code. What I have so far: [CODE]import random import math keys='abcdefghijklmnopqrstuvwxyz ' monkey='methinks it is like a weasel' def attempt(): attempt='' for i in range(len(monkey)): x=random.choice(keys) attempt+=x return(attempt) library_attempts=[] for i in …

Member Avatar for TrustyTony
0
98
Member Avatar for dustbunny000

Hi there. I am trying write a module that can be executed at the command line and for some reason it's not working. Does anyone know why? [CODE]import sys def fibonacci(N): a,b =0,1 while b < N: a,b = b, a+b print b N=sys.argv[1][/CODE] Does it matter that I'm running …

Member Avatar for TrustyTony
0
92
Member Avatar for pythonbegin

Dear All I am working with a tab-delimeted files - first two columns are pairs of identifiers and third column is floating point number (0-1) denoting interaction strength between colmn1 and 2. sample file is also attached. eg- column1 column2 column3 john steve 0.67588 john matt 1.00 red blue 0.90 …

Member Avatar for TrustyTony
0
99
Member Avatar for novice20

could anyone help me regarding calling different python scripts from within a main script.How can this be acheived? Thanks in advance

Member Avatar for cghtkh
0
225
Member Avatar for dustbunny000

for: [CODE]import random keys='abcdefghijklmnopqrstuvwxyz ' random.choice(keys)[/CODE] How would I count how many times it takes random.choices(keys) to generate "m"?

Member Avatar for D33wakar
0
166
Member Avatar for Wumbate

Here's a weird one: I have a Tkinter.Text widget that I import data from with inputText.get(1.0,END) However, later in the program I have the text in an array, but the array has values like: 'u\x00s\x00e\x00r\x00' Is there a way to decode this weird string to a normal string? I think …

Member Avatar for D33wakar
0
89

The End.