15,185 Topics

Member Avatar for
Member Avatar for olofom

I'm writing a slideshow program with Tkinter, but I don't know how to go to the next image without binding a key. [CODE=python]import os, sys import Tkinter import Image, ImageTk import time root = Tkinter.Tk() w, h = root.winfo_screenwidth(), root.winfo_screenheight() root.overrideredirect(1) root.geometry("%dx%d+0+0" % (w, h)) root.focus_set() root.bind("<Escape>", lambda e: e.widget.quit()) …

Member Avatar for olofom
0
307
Member Avatar for DayneD89

I'm fairly sure this will be my second thread to make me facepalm when I realise what I've missed, but oh well. If I have a list, for example L=[0,1,2,3,4], can I take the values out so that, again for example, t1 = 0, t2=1, etc.? The easy way would …

Member Avatar for vegaseat
0
154
Member Avatar for camigirl4k3

the program I had looks like this: def wordToNumber(word): if word == "one": return 1 elif word == "two": return 2 elif word == "three": return 3 elif word == "four": return 4 elif word == "five": return 5 elif word == "six": return 6 elif word == "seven": return …

Member Avatar for TrustyTony
0
129
Member Avatar for lmn_k

Hi all. I'm taking a beginner python course and have an assignment to write code using a 'for loop' + 'named variable' + 'branching logic' Trouble is, I have no idea what 'branching logic' is - if anyone has the time to respond, I'd really appreciate it!

Member Avatar for lmn_k
0
102
Member Avatar for jaferic

Hi, i am currently developing a standalone aplication in python, i am very new in this language so i don't know much of it... I need your help, i need to know a way to communicate python and AS3 so i can move the animations with some data that comes …

Member Avatar for jaferic
0
182
Member Avatar for johnnyd1986

I need to know what the command is for setting a specific set of decimal places in an answer, somewhat like the PHP number_format command. Here is what I got coming up in my answer.... 0.7893948 I need it so it says: .789 Anyone have an idea of what the …

Member Avatar for snippsat
0
168
Member Avatar for HiHe

I am using Python 3.1.2 What is the best way to get numeric (float or int) user input?

Member Avatar for TrustyTony
0
4K
Member Avatar for player1977

Hi all. I'm a newbie here so excuse my question if it's a bit dumb. I'm a C programmer but needed to do some text file stripping so was told Pythin would be good for this. I have been messing about with this for about a week now and have …

Member Avatar for TrustyTony
0
83
Member Avatar for thepond

I am learning Python 3 I have several pieces of code that compares dates. The problem is I don't understand how to read a date from a text file and then use it in my code so I can compare it with todays date. I get errors like - int …

Member Avatar for TrustyTony
0
109
Member Avatar for ultimatebuster

I know I can accomplish this with Regex, however, being not familiar with RegEX (yet to find a good howto/reference), I was wondering if there's other simple ways to parce XML files, or if there's a tutorial for regex somewhere For example, I want to get the Hello World! from …

Member Avatar for ultimatebuster
0
196
Member Avatar for Archenemie

This one has got me completely, i cant see why the notebook doesnt show, i wanted the gui interface i have already built to show on page 2 of the notebook, but for some wierd reason the page just comes up empty, and it is really baffeling me. Can anyone …

Member Avatar for Archenemie
0
279
Member Avatar for narfman0

Hello all, I am trying to automate my builds so that when I commit a branch with a particular url to my svn repository, my python script (which runs twice daily) will pick up on it, do a build, and upload it to a new trac downloads page. Right now …

Member Avatar for narfman0
0
178
Member Avatar for dbphydb

Hi, I am basically from QA. What we testers do each day is 1. Open a web browser. Type in [url]http://hostname:8080/cruisecontrol[/url] (since we are in a particular network, only we can access this) 2. Check if the latest nightly build has been successful. If it is successful, deploy it on …

Member Avatar for TrustyTony
0
83
Member Avatar for daviddoria

I am trying to parse the content of a wiki page. In a string like this: [code] ==Heading1== <test> some text here </test> ==Heading2== <test> even more text </test> [/code] I need to obtain "Heading1", "some text here", "Heading2" and "even more text". I got this to work: [code] import …

Member Avatar for daviddoria
0
15K
Member Avatar for DayneD89

OK, I'm new to python. I'm writing data to a file, but it won't write that data to a new line. I'm ending up with a single line file that reads as [QUOTE]2.0/n3.0/n2.0/n3.0/n2.0/n3.0/n2.0/n3.0/n2.0/n3.0/n2.0/n3.0/n2.0/n3.0/n[2.0, 2.0]/n[3.0, 3.0]/n[2.0, 2.0]/n[3.0, 3.0]/n[2.0, 2.0]/n[3.0, 3.0]/n[2.0, 2.0]/n[3.0, 3.0]/n[2.0, 2.0]/n[3.0, 3.0]/n[2.0, 2.0]/n[3.0, 3.0]/n[2.0, 2.0]/n[3.0, 3.0]/n[2.0, 2.0]/n[3.0, 3.0]/n[/QUOTE] When …

Member Avatar for DayneD89
0
5K
Member Avatar for freakn_style

[U][B]Explanation on why program must maintain simplicity:[/B][/U]I am a peer tutor of a computer programming class and my teacher has asked me to develop a few simple games to teach the class. This is the first year the school has taught Python (thanks to my final project last semester, and …

Member Avatar for freakn_style
0
1K
Member Avatar for notuserfriendly

Hello, i am currently writing an assembler for the theoretical SIC/xe machine and i decided to do it in python. Very new to python but i thought it would be fund to do it in and willing to learn. So far i know what to do and have the diea …

Member Avatar for woooee
0
504
Member Avatar for Ntsoaki

[code] import sys import random sys.setrecursionlimit(1500) def prime(n): """ Generate all prime numbers less than n. """ yield 2 primes = [] for m in range(3,n,2): if all(m%p for p in primes): primes.append(m) yield m n=int(raw_input()) i=0 j=0 while(n!=-1): p=list(prime(n)) sun=0 while(sun!=n and i<1000000000000000000000000000000): F=random.sample(p,4) sun=sum(F) i+=1 if(sun==n): for i …

Member Avatar for TrustyTony
0
138
Member Avatar for Ntsoaki

Hi i am new in python,i have just got a question below A friend of yours has just bought a new computer. Until now, the most powerful computer he had ever used was a pocket calculator. Now, looking at his new computer, he is a bit disappointed, because he liked …

Member Avatar for TrustyTony
0
286
Member Avatar for JJBallanger

I have recently been given quite a complex piece of work to do by my computer science supervisor. The idea is that the function:- [def shape_resistivity(shape,R):] allows the user to input a shape and resistance value like so: [CODE] [shape=[\ ' ', '++++', 'xxxx', 'xxxx', 'xxxx', '----', ' '] [/CODE] …

Member Avatar for JJBallanger
0
624
Member Avatar for Arfarf

Howdy! I'm trying to get my head around some simple pattern matching or regular expressions using python. Basically I want to be able to match "Failed 0.00/100.00", where 0.00 could be any decimal number. I know using perl it would be something along the lines of "\d+\.\d+\/100\.0", but could anybody …

Member Avatar for Arfarf
0
119
Member Avatar for peppermints

So I'm trying to get it to update the score by 30 each time a fly is hit. I've tried this a number of ways, but none of them seem to be working. Here is my code (I've commented out some unneeded things so I didn't have to upload so …

Member Avatar for vegaseat
0
1K
Member Avatar for carpenoctem

Haha, still not getting the hang of this, I am afraid. I have written a script: [CODE]#!/usr/bin/env python print ("Hello, world!") name = input("What is your name? ") print ("Hello, " + name + "!")[/CODE] I have saved it as hello.py. And I try to make it executable in terminal: …

Member Avatar for vegaseat
0
311
Member Avatar for DancingDana

Hello, I've got this directory with files that contain a number in their file name. I need to check what the number is and then I need to move the file to a different directory. Right now I'm using shutil to do this, but for some reason it copies the …

Member Avatar for DancingDana
0
220
Member Avatar for sarfrazashfaq

Hi there I am translating PERL code into PYTHON Code My PERL code is if ( my $client = $dealing_clients->{ $data->{fundId} } ) And i translated it into python as if (client = dealing_clients[data["fundId"]]): But it is giving my following Error "Syntax Error While detecting Tuple" Any one know how …

Member Avatar for sarfrazashfaq
0
691
Member Avatar for carpenoctem

I am trying to run my first program/script (pardon my bad terminology, I am a newbie), and just doesn't work. I am using Ubuntu, and IDLE. and I have written: [CODE]print "Hello, world!" [/CODE] I saved the file as hello.py. Tried to click Run - Run Module, but then it …

Member Avatar for carpenoctem
0
97
Member Avatar for Archenemie

I need to make it so when i click the Do IT botton the variables ive shown take the values of the text control box ive selected, and after an hour trolling the internet and trying different lines of code i still have no clue. Does anyone have any ideas? …

Member Avatar for vegaseat
0
273
Member Avatar for Robbert

Hi, I could do with some help with how to clear a panel(self.panel1) so the new buttons load in a new/clean panel(self.panel1) in the following code when either "Button One" or "Button Two" has been selected at the top of the frame. I have tried everything I could think of …

0
273
Member Avatar for nsutton

Ok so I'm working on an address book app in python. the user writes contacts into a txt file and can search for it and everything.(run the code yourself if you want to see what it does) now for my problem, under "#if editing" i want have the user search …

Member Avatar for nsutton
0
2K
Member Avatar for leegeorg07

Hi again i have programmed a thing that asks for 2 numbers and does a series of things to it.But i want to round the square-rooted numbers to about 6 digits e.g. 5.12345. How can this be done? Here is my code: [ICODE]from math import sqrt running = 'Y' while …

Member Avatar for vegaseat
0
488

The End.