Hello all,
As I mentioned in my recent emails, I've been working on a program that
will display the currently playing iTunes track (for example, when
iTunes is minimized to the system tray so that you don't have to enlarge
it again just to see the name of the song). Unfortunately, of the
Alan Gauld wrote:
Orri Ganel [EMAIL PROTECTED] wrote
been fruitless. My best guess is something along the lines of:
iTunes =
win32com.client.gencache.EnsureDispatch(iTunes.Application)
iTunesEvents = win32com.client.WithEvents(iTunes,
iTunesEventHandler)
where iTunesEventHandler
Hello again. As I've mentioned in the last couple of emails, I'm having
trouble registering iTunes for events, and I don't know if it's a bug
with iTunes or with win32com, or if there's something I'm doing wrong.
So, if any win32com gurus out there know why the following doesn't work
and how
Alan Gauld wrote:
Orri Ganel [EMAIL PROTECTED] wrote
In the end, setting lbl[image] = worked
Glad it worked. I was just about to suggest creating an image
with the No image text in it. You could then just display that
as the default image...
Alan G
Hello all,
As part of a tkinter program that displays the currently playing
track's information (including artwork) from iTunes, I have a label
with an image in it (the artwork). However, when the song played
doesn't have artwork, I'd like to remove artwork of the old song and
replace it with
Orri Ganel wrote:
Hello all,
As part of a tkinter program that displays the currently playing
track's information (including artwork) from iTunes, I have a label
with an image in it (the artwork). However, when the song played
doesn't have artwork, I'd like to remove artwork of the old
Oops, please send any questions to this email, not the one I sent the
last message with.
Thanks,
Orri
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello all,
I'm working on the GUI for my extended iTunes search, which allows
searches far beyond the native iTunes capability. Once the search has
been completed, a window contining a Tix.CheckList with the resulting
tracks is displayed. If anyone has any idea how to figure out whether
or
As a follow up to my last email, I think the issue is more that the
display doesn't update before the command associated with the search
button has finished processing, so any attempts to get data about the
display from within the method are fruitless since the display hasn't
changed yet. I
Oops, forgot to reply to the list; sorry everyone.
--
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.
---BeginMessage---
Emily Fortuna wrote:
Thanks, I knew there had to be a really simple way to do it.
Emily
Orri Ganel wrote:
Emily Fortuna
Alan Gauld wrote:
How do I create the equivalent of a Java class in Python? I've been
looking
at the reference, and it's been confusing to me at least.
Adapted from my book:
Java code:
class Msg{
private String txt;
public Msg(String s){
this.txt = s;
}
My only comment is that this considers spaces and punctuation (like parentheses, brackets, etc.), too, which I assume you don't want seeing as how that has little to do with natural languages. My suggestion would be to remove the any punctuation or whitespace keys from the dictionary after you've
Carroll, Barry wrote:
Greetings:
I have a function that computes the checksum of an integer, including or
excluding digits in the computation based on the content of a mask string.
For example,
cksum(123456789, '***...***')
will do its computation on 123789, masking out the three
Rinzwind wrote:
In basic I can use SGN to get back -1, 0, +1 if a number
is 0, 0, 0.
I searched on the web for a bit but sgn and sign give me way too many
discussions about Decimals. python.org
with numbers/digits doesn't tell about a function.
Maybe Python uses a different name for it so I
), (57, 80, 33), (60, 78, 35),
(32, 21, 39), (70, 95, 39), (21, 92, 69), (16, 70, 87), (40, 18, 90)]
Rinzwind wrote:
Thank you!
*opens manual again*
Wim
On 1/26/06, Orri Ganel [EMAIL PROTECTED]
wrote:
Well,
the cmp() function does this if you compare the number
to 0:
cmp(-34,0
Kent Johnson wrote:
variable, it has no effect outside the method; inside a method, self is
just a method parameter, nothing more. There is some magic that gives
self its value for the call.
When __init__() is called the new instance has already been created, you
are just initializing
Hans Dushanthakumar wrote:
Thanks for your reply Kent.
Is it possible to dynamically import a module?
The foll snippet of code throws an error ImportError: No module named
testname
t = [test1.py, test2.py] #Actually this list is filled in by a
Tkinter Listbox selection.
for f in t:
Hans Dushanthakumar wrote:
Oops answered my own question. Dynamic importing is done using the
__import__ function:
t = [test1.py, test2.py] #Actually this list is filled in by a
Tkinter Listbox selection.
for f in t:
testname = f[:-3]
test = __import__(%s%(testname))
res =
Carroll, Barry wrote:
Greetings:
My UDP client is receiving responses from the server, and now I need to
process them. A typical response string looks like this:
(0, ''),some data from the test system
The tuple represents the error code and message. If the command had failed,
the
Title: [Tutor]: [Slightly OT] Using Python to intercept audio from a
program
Hello all,
A week or two ago I sent in a few emails regarding using threads in
automating conversion between wav's and mp3's using lame. However, the
program I use to generate these wav's, Audacity (a great program,
By the way, if it makes a difference, the program I intend to attempt
this with is Rhapsody http://www.rhapsody.com/, a part of the
RealPlayer collection of media software.
--
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.
Not sure what IIUC stands for, but I am, indeed, running windows. XP Home Edition, in fact, with Python 2.4.2 finalOn 10/24/05, Kent Johnson
[EMAIL PROTECTED] wrote:Hugo González Monteverde wrote: I have done scripts for decompressing MP3 in the past. I normally follow
a fork() exec() subprocess
I knew what he meant, but since most albums have around 12 tracks, 4
tracks per thread gives you 3 threads. In any case, thanks for the
catch on the loop. I'll let you know if it makes a difference.On 10/22/05, Kent Johnson [EMAIL PROTECTED] wrote:
Alan means to use two or three threads
I'll try doing 3 or 4 tracks per thread, then. Thanks for the advice.If you keep the thread count down to two or three you might get
a noticable improvement but one thread per track, unless you havea lot of separate hard disk spindles to distribute the work willnot help much I suspect.Alan G.
--
Christopher Arndt wrote:
Hi,
I wonder if there is a shorter form of the following idiom:
list1 = []
list2 = []
for item in original_list:
if condition(item):
list1.append(item)
else:
list2.append(item)
(optional step:)
original_list[:] = list1
I call this the
Bill Burns wrote:
Kent,
Thank you for the reply! I knew there had to be a different way to do
it, I didn't like the three lists in there either :-)
One thing:
I had to change the line
wRes = float(data[1][1:])
it was returning '00,' (zero, zero, comma) instead of '400', so I
changed it to
On 8/28/05, Tom Strickland [EMAIL PROTECTED] wrote:
Tom Strickland wrote:Here are the modules in question:--SNIP--
##This is the enterData.py module ##!/usr/bin/python2.4 input = open('/home/tom/Python/Input/SPY2.csv', 'r') s = input date =[] open = [] close = [] hi = []
lo = [] vol = [] for
Daniel Watkins wrote:
I'm currently trying to write a script that will get all the files
necessary for a webpage to display correctly, followed by all the
intra-site pages and such forth, in order to try and retrieve one of the
many sites I have got jumbled up on my webspace. After starting the
Byron wrote:
Hi Johan,
It's actually fairly simply and straight forward... Here's how to do
it: (I haven't officially tested this code for bugs, but I believe it
is correct.)
file = open(datafile.txt, r)
filedata = file.read()
file.close()
newLine = Your new line of data with the time
Jonas Melian wrote:
v = 64x43x12 - '64x43', '12'
How split it by the las 'x'?
In 2.4 it could be used rsplit(x,1)
but i've 2.3.5
Is there another way of splitting a string from the end?
___
Tutor maillist - [EMAIL PROTECTED]
EJP wrote:
Well, like I said, the darkplayer is on an online journal, which means
that the only output possible is modifying the option strings of songs
as they are played or something similar. I do know that the random
number generator works, and the songs played always match the option
Alan G wrote:
HI Orri,
OK, so what happened?
You still aren't telling us what happens. Its very hard to find
a fault in a program when you have no idea what the problem is.
The code is very likely doing what you have asked it to do,
so when we read it it will seem to 'work' at a
Kent Johnson wrote:
Liam Clarke wrote:
Um, man, that's what I hate about Javascript, it fails silently. I've
never met a Javascript console...
/me ponders Firefox plugin.
Firefox has a JavaScript console that can be helpful...
Kent
Many thanks. I was not aware of this.
--
Email:
Alan G wrote:
The problem lies not on the server but on the client.
JavaScript support is embedded in every popular browser so it just
works, but none of them know about python. Even if they did it would
require the user to have Python installed, which you can't assume.
It is possible to
Alan G wrote:
OK, so what happened?
Did you start just making the copy and playing the songs from the
copy?
Did that work OK?
Does the random number generation work - I assume you tested that by
just writing out the sequence of numbers first?
And finally when you use the random numbvers to
Hello all,
I've been trying to use javascript for coding something on a webpage,
and I've just about given up on understanding the intricacies of why a
given script will work now and not in 5 minutes, and why any bit of code
longer than 5 lines doesn't behave as documented. Therefore, I
Hello all,
First and foremost, for those who don't know, www.pythonchallenge.com
is a set of python-related riddles. Now, for those who are past level
six, any sort of hint would be appreciated. Right now, all I know is
what module to use (i think) and that I have to somehow use it on
On 4/14/05, Rich Krauter [EMAIL PROTECTED] wrote:
Maybe you could use a factory. It would allow you to simplify your Node
class, and encapsulate the instantiation behavior you want outside the
class.
Thanks for the suggestion; I think that's what I'll do.
On 4/14/05, Max Noel [EMAIL
Hello all,
True to Pierre's suggestion, I have reimplemented LinkedList without
embedding a list in it. I also took out the dictionary, on the basis
that dictionaries can behave as badly as O(n), and often behave
O(log(n)), depending on the hash function they're based on, and the
point of a
Well, what I ended up doing is making it so that Nodes are equal if
they have the same 'cargo', but hash based on memory address. If this
wasn't the case, I either wouldn't be able to have multiple Nodes with
the same 'cargo' in a LinkedList, or I wouldn't be able to sort them
properly, among
Hello all,
I've been working on making a complete pythonic LinkedList
implementation, as per the specifications of Java's LinkedList and
Python's list. The full code may be found at
http://rafb.net/paste/results/JKhsQn59.html. Once the link expires,
please feel free to email me for the code.
I'm not at all sure this is, indeed, helpful *grin*. I was just
looking for a project to code, and decided to implement a LinkedList.
The how of using it is very simple: in the same way you would use a
regular list. Except for a few extra/different methods, the use of
LinkedList is very similar
Hello all,
While I do not have a pressing need to hash a list, I am curious as to
why, if lists are unhashable, there is a __hash__() method in the list
class, which also does not work on lists, but results in a 'TypeError:
list objects are unhashable'. What's the point of including a
__hash__()
Hello all,
I am attempting to implement a LinkedList in Python, and in doing so,
have created a Node class which represents the elements of the
LinkedList. However, since these Nodes have custom-defined __lt__(),
__gt__(), __le__(), __ge__(), __eq__(), and __ne__() methods, they
are, for some
So, any class that has 'rich comparison methods' defined is
unhashable? What gives? (See '[Tutor] unhashable objects')
On Sun, 27 Mar 2005 12:38:09 -0800 (PST), Danny Yoo
[EMAIL PROTECTED] wrote:
On Sun, 27 Mar 2005, Orri Ganel wrote:
While I do not have a pressing need to hash a list
Sandip Bhattacharya wrote:
for x in string:
if x in chars:
string[i] = ''
I just have a hangover from other languages, but I really wanted to
know how Python handles iteration over a variable which is being
changed within the loop itself. Is the for condition evaluated in
Gregor Lingl wrote:
Hi all of you,
I'm representing a 4x4 matrix as a 16-element list, e.g.
m=range(16)
first 4 elements first row, second four elements second row etc.
I want to sum rows and columns like
i-th row:
sum(m[4*i:4*i+4])
and ith column:
sum(m[i::4])
This seems to be slow because of the
Kent Johnson wrote:
Bob Gailer wrote:
At 04:43 AM 1/29/2005, Liam Clarke wrote:
erk, to the list, to the List!
if ( bad_weather =='y' ):
# ask user only if weather is bad.
b = input ( Weather is really bad, still go out to jog?[y/n] )
if b == 'y':
go_jogging()
Anyone else notice
Gilbert Tsang wrote:
Hi there, I have this logic that I cannot wrap my mind it:
def go_jogging():
# go out and jog
return
if ( bad_weather =='y' ):
# ask user only if weather is bad.
b = input ( Weather is really bad, still go out to jog?[y/n] )
if b == 'y':
go_jogging()
Gilbert Tsang wrote:
Hi there, I have this logic that I cannot wrap my mind it:
def go_jogging():
# go out and jog
return
if ( bad_weather =='y' ):
# ask user only if weather is bad.
b = input ( Weather is really bad, still go out to jog?[y/n] )
if b == 'y':
go_jogging()
Ali Polatel wrote:
dear friends ,
I found acode which calculates pi with an interesting algorithm
the programme code is below:
from sys import stdout
def f((q,r,t,k)):
n = (3*q+r) / t
if (4*q+r) / t == n:
return (10*q,10*(r-n*t),t,k,n)
else:
return (q*k,
Jacob S. wrote:
Ahh, my pitiful form of flattening a list that cheats...
def flatten(li):
li = str(li)
li = li.replace([,)
li = li.replace(],)
li = li.replace((,)
li = li.replace(),)
li = [%s]%li
return eval(li)
It works! It's probably just a bit slower.
Jacob Schmidt
J. M. Strother wrote:
I have a
text file containing 336 records.
I can read and print out the whole file without any problem.
What I want to do is read and print out one record only (chosen at
random). So I need to get to record x, select it, and then print it (or
store it in a
Jay Loden wrote:
One simple solution is to do:
fle = open(file)
contents = file.readlines()
file.close()
print contents[x] #or store this in a variable, whatever
-Jay
On Friday 21 January 2005 11:22, J. M. Strother wrote:
I have a text file containing 336 records.
I can read
Jacob S. wrote:
Hi all,
I'm having a problem that is ticking me off. (to put it lightly)
Why does decimal do this -- I thought that getcontext().prec was
number of decimal places?
import decimal
decimal.getcontext().prec = 2
a =
Title: RE:
Gopinath V, ASDC Chennai wrote:
On Wed, 12 Jan 2005, Orri Ganel wrote:
stuff = [[0,'sdfsd','wrtew'],
[1, 'rht','erterg']]
stuff
[[0, 'sdfsd', 'wrtew'], [1, 'rht', 'erterg']]
print [stuff[i][0] for i in
range(len(stuff))]
[0, 1
. The
Snack Sound Toolkit in particular. http://www.speech.kth.se/snack/
OTOH if what you want is some kind of macro system for Audacity then
this won't help.
Kent
Orri Ganel wrote:
I did some googling, and found this in the archives of this mailing
list:
import os
os.system('c:\\abaqus\\5.8-14
Bill Burns wrote:
I accidentally sent my reply to Kent only. So I'm forwarding it to the list.
Bill
-- Forwarded Message --
Subject: Re: [Tutor] Posting a large amount of code?
Date: Sunday 16 January 2005 10:14 am
From: Bill Burns [EMAIL PROTECTED]
To: Kent Johnson
Alan Gauld wrote:
I'm trying to use Python to start the dos-box ("cmd.exe") and be
able to
call commands on it and receive output from it.
The Command window is just a terminal, there is no output to
be had other than an exit code when it closes.
I did some googling, and found this in the archives of this mailing
list:
import os
os.system('c:\\abaqus\\5.8-14\\abaqus.exe post')
, where post was a command, *not* a file. Now, I tried something
similar, since essentially what I wish to be able to do is have
Audacity think I typed the
Kent Johnson wrote:
Just join the individual strings together with | to make a single
regex, then search each line for a match:
import re
lista = ['hello','goodbye','bubblegum']
regex = re.compile('|'.join(lista))
lines = '''line1: blah blah aldkfslfjlajf hello
... line2: blah blah
Vincent Wan wrote:
If I have a list stuff = [[0,sdfsd,wrtew], [1, rht,erterg]] whats the
most concise way to print the first elements:
[0, 1]
if triedprint stuff[:][0] but that just prints the whole list.
Vincent
I don't know about a large calculation time, but this seems to work:
def rightshift(a):
ia = a[:]
for i in range(len(ia)-1,0,-1):
if ia[i-1] == 1 and ia[i]!=1:
ia[i]=1
ia[i-1]=0
return ia
l
Yes, but your way only works when the numbers in the list are single digit:
def listtoint(digits):
result = 0
for digit in digits:
result *= 10
result += digit
return result
listtoint([1,2,3,4])
1234
listtoint([11,22,33,44])
13574
--
Email: singingxduck AT gmail
Karl,
The ''.join() method was the first one suggested. Roel then suggested
a math-based method, which I attempted to improve upon.
--
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.
___
Tutor maillist -
On Thu, 23 Dec 2004 20:42:50 +0800, Juan Shen [EMAIL PROTECTED] wrote:
I have found there are easy functions and options to do basic octal and
hexadecimal number operation.
oct(...)
oct(number) - string
Return the octal representation of an integer or long integer.
hex(...)
On Wed, 15 Dec 2004 17:47:58 -0800 (PST), Tony Cappellini
[EMAIL PROTECTED] wrote:
I'm trying to get Python to automatically print a leading 0 for hex
numbers, but it only
seems to work for for decimal numbers.
print 0x%0X % 12345
displays
0x3039
instead of 0x03039
The Python
On Thu, 9 Dec 2004 19:31:22 -0500, Jacob S. [EMAIL PROTECTED] wrote:
Hi all.
Nothing I can do can fix my problem. It appears as though pythonw.exe is
not working properly in the python 2.4 distribution. I have tried numerous
things to try and fix it. The only way I can run Tk scripts and
Hello all,
I recently downloaded Psyco and put it in the site-packages folder.
Now, when i tried to use it to optimize a program, IDLE says it can't
find it:
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
Type copyright, credits or license() for more information.
Hello all,
Well, the best way to explain is to take an example. Let's say you
want to calculate ((2 + 5) * 3 - (4 / 6)) * ((8 - 2 * 3) / 9 + (10 -
1))
SNIP
In other words, if you were
using a HP48, here's what you'd be inputting:
2
5
+
3
*
4
6
/
8
2
3
*
-
9
/
10
70 matches
Mail list logo