Re: [Tutor] convert a file from plaintext(Ascii) to unicode? very quickquestions

2005-08-16 Thread Michael Lange
if you want to convert ascii into unicode you need to call * decode() * ( which does pretty much the same as unicode() ) on the string, not encode() . Michael > luke wrote: > > List: > > I'm forwarding this private message(hope you don't mind Denise) > > I personally

Re: [Tutor] LiveWires problems

2005-08-16 Thread Michael Murphy
Compiling it in Root worked, thanks. On 8/16/05, Luis N <[EMAIL PROTECTED]> wrote: > On 8/15/05, ZIYAD A. M. AL-BATLY <[EMAIL PROTECTED]> wrote: > > On Mon, 2005-08-15 at 11:52 -0400, Michael Murphy wrote: > > > Hi all > > > > > > I'm having p

Re: [Tutor] how to make a script do two things at once.

2005-08-22 Thread Michael Lange
the count (or delaying it unill the > script called exits) I don' t have to run it this way, i can import it > if necessary as a module. or whatever will work so i can execute two > things at once. > If you just need to call a unix system command you

Re: [Tutor] upgrading from 2.3 to 2.4.1 on Mandrake Linux 10.1

2005-09-12 Thread Michael Lange
bably have to edit the shebandg line in BOA's main program file (or type python2.4 boa (or however the main program is called). Maybe you can find mandrake source RPM's for these, too, which might make it easier for you to install everything in the correct place. I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Focus in tkinter

2005-09-14 Thread Michael Lange
on/index.htm> I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] where to insert?

2005-09-23 Thread Michael Janssen
ig one ... In fact for small strings and a small numer of them, the joining-a-list approach can take more time. This is why I prefer to add strings directly and only switch to an temporary list when I have really many strings or when I gain some other advantages, when I e.g. want to join the s

Re: [Tutor] Diamond Equivalent

2005-09-23 Thread Michael Sparks
nd_lines() firstline = diamond_iterator.next() remaining_lines = list(diamond_iterator.next()) Or to show a relatively common perl idiom: $firstline, @remaining_lines= <>,<>; Maps to: diamond_iterator = diamond_lines() firstline,remaining_lines = diamo

Re: [Tutor] Linking with C programs

2005-09-27 Thread Michael Sparks
t work, and even shows you how to use distutils (aka setup.py) to make it easy for others to build your bindings too. * http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ * http://ldots.org/pyrex-guide/ - Michael Smith's guide to Pyrex - it's IMO brilliant and the examples work,

Re: [Tutor] Embedding

2005-09-27 Thread Michael Sparks
ople who know C/C++/Java to python). Michael. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] stopping threads?

2005-09-29 Thread Michael Sparks
ve included the reply I gave illustrating what can go wrong if you don't use super at the end. Regards, Michael. --- Original post regarding super: Subject: Re: Using superclass __init__ method paul brian wrote: > class Base: >def __init__(self): >print "hello

Re: [Tutor] call a def/class by reference

2005-09-29 Thread Michael Sparks
portError: def sched_yield(): pass except AttributeError: def sched_yield(): pass It's pretty much the same thing. I could see that this may have uses in systems that allow plugins. Devils-advocate-ly , ;-) Michael. ___ Tutor maillist

[Tutor] Request for newbies :-)

2005-09-30 Thread Michael Sparks
Thanks in advance to anyone willing to give this a go, and to others for their patience regarding this message! Best Regards, Michael. -- Michael Sparks, Senior R&D Engineer, Digital Media Group [EMAIL PROTECTED], http://kamaelia.sourceforge.net/ British Broadcasting Corporation, Research and Dev

Re: [Tutor] More than one thing at a time?

2005-10-01 Thread Michael Sparks
1 If the OP does choose to take this approach, they'd need to use a CVS checkout rather than the main release though since we haven't done a release yet including the TK stuff (Though one is imminent). One key aim of Kamaelia is to make it simple & easy to make it possibl

Re: [Tutor] More than one thing at a time?

2005-10-02 Thread Michael Sparks
[ cc'ing the Kamaelia list in case it makes sense to move this conversation  there. ] On Sunday 02 October 2005 15:20, Joseph Quigley wrote: > Hi Michael, > You're explanation helped a lot, however, I'm really not good at gui > programming and the irc client was

[Tutor] Consistant Overhead Byte Stuffing (COBS) algorithm help

2005-10-03 Thread Michael Cotherman
Hello, I am really new to python and really have not programmed much since college, I played with it a little now, and it seems to be a tool I feel comfortable implementing a personal project in. I wish to communicate via a serial port to a device that is using COBS. I wish to configure it and the

Re: [Tutor] Consistant Overhead Byte Stuffing (COBS) algorithm help

2005-10-04 Thread Michael Cotherman
A little more info is below: With miniterm modified to output hex to the screen, here is the data coming in unformatted. (note zero bytes delimit end of packet): c:\Python23>python miniterm1.1a.py --- Miniterm --- type ESC to quit 0002860104DB203F0102860504CB1A740102860504CB1B7401028

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Michael Cotherman
This is exactly what i was looking for For those following, the \x00 added at the end of the packet is just imaginary and represents in the meantime, I made the following that just 'decobs' a series of packets (only 8-10 bytes) that are coming in over the com port. (my incoming packets also b

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Michael Cotherman
def UnStuffData(src,dst,len): for code in src: for i in range(1,code): dst.append(i) if code < 0xff dst.append('\0') the above is the below code uncommented... it(and the original code) just seem to find the end and puts a zero there... I do not see the exis

Re: [Tutor] Did anyone get the Kamaelia "Conversing" chapter 5 to work?

2005-10-06 Thread Michael Sparks
erested in hearing. If it's difficult, what was difficult (naff HTML for example...), if it was clear/unclear, that sort of thing. That said, this query is useful feedback in itself :) Best Regards, (and apologies for the HTML formatting ... :-( Michael. -- Michael Sparks, Senior R&am

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-06 Thread Michael Cotherman
): if i == x: dst.append('\0') x = src(i) else: dst.append(i) dst.pop(0) #remove first byte # if code < 0xff # dst.append('\0') -mike --- Kent Johnson <[EMAIL PRO

Re: [Tutor] Did anyone get the Kamaelia "Conversing" chapter 5 to work?

2005-10-07 Thread Michael Sparks
s useful - very useful - and I hope the tutorial helped with understanding generators, how to use them and what they could be used for (if you weren't already comfortable with them :-) Best regards, Michael. -- "Though we are not now that which in days of old moved heaven and earth, th

Re: [Tutor] New Python book

2005-10-07 Thread Michael Sparks
rces to the examples for this update though it looks like he's using wx extensively throughout, which strikes me as both a good & bad choice. Good in that wx is pretty good, bad in that using Tk would IMO be better since python ships with

Re: [Tutor] Is it Posible? To Crack And HowTo

2005-10-07 Thread Michael Sparks
lity soley to destroying the incomes of people (which is what you do if you /release. a crack) . Alternatively you could take that energy and ability into building better things. Destruction or construction? your choice. I doubt you'll find many, if any, people to aid you in a destruc

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-07 Thread Michael Cotherman
The c code seems to be walking through the list moving bytes from src to dst, but the python code below seems to take one byte from src, start counitng up to the value from 1 and appending each and every value along the way to dst, no? -mike --- Alan Gauld <[EMAIL PROTECTED]> wrote: > > I am a

Re: [Tutor] New image with Tkinter?

2005-10-10 Thread Michael Lange
def newPic(): global pic pic = pic + 1 imgPrep.configure(file=os.path.join(imgDir, pics[pic])) Button(app, text="Next Image", command=newPic).grid() Button(app, text="Close", command=quitProg).grid() app.mainloop() I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tutor Digest, Vol 20, Issue 37

2005-10-11 Thread Michael Lange
age(file=file=os.path.join(imgDir, pics[pic])) imgShow.configure(image=imgPrep) The configure() method works for Tkinter.PhotoImage, but obviously not for ImageTk.PhotoImage, so I got trapped here. Regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] comiling python to microchip?

2005-10-12 Thread Michael Sparks
ovements - though interpreted pypy itself (or translated) is still *a lot* slower than regular C-Python). Pypy isn't ready (last time I looked) for general consumption yet, and certainly not for beginners :) Michael. ___ Tutor maillist - Tutor@py

Re: [Tutor] how to extract number of files from directory

2005-10-12 Thread Michael Sparks
extension = f.split(".")[-1] if extension.lower() in extns: piccies.append(filename) num_files = len(piccies) Regards, Michael. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] comiling python to microchip?

2005-10-13 Thread Michael Sparks
On Thursday 13 October 2005 01:08, Kent Johnson wrote: > Michael Sparks wrote: > > On Wednesday 12 October 2005 23:19, Kent Johnson wrote: > >>I don't think you can compile python code > > > > Pypy can compile a restricted subset of python... > > There is

Re: [Tutor] Getting info about processes via pid

2005-10-13 Thread Dwyer, Michael
Hi Lawrence, In a UNIX environment the method used to determine if a process is running is to issue a "kill -0 pid". If the process is running the return value will be zero (0) and -1 with errno set to ESRCH - No process or process group can be found corresponding to that specified by pid. THANX

Re: [Tutor] help

2005-10-24 Thread Michael Janssen
ckets but you need the comma: s.find('something', 1) The builtin documentation ist meant (there are such statements by Guido van Rossum in the web) as a brief mnemonic for things that are explained in more detail in the library documentation and the tutorial. regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Real newbie - python can't open spam.py

2005-10-29 Thread Michael Rowan
Hi I'm on my first day with python2.3 on Windows XP. I'm able to run python interactively. I've created a text file using NotePad, named it spam.py (as per O'REILLY Learning Python, p13) contents as folows import sys print sys.argv If I do: >python spam.py it says can't open file 'spam.p

[Tutor] File IO

2005-11-03 Thread Michael Haft
Hello, I tried the following code: def readSOMNETM(inputName): input = open(inputName, "r") result = [] for line in input: fields = line.split() data = fields[1] + fields[2] + fields[7] result.append(data) input.close() return result print "Here g

Re: [Tutor] TKinter Question

2005-11-08 Thread Michael Lange
/tkdnd); I wrote a Tkinter wrapper for tkdnd (http://www.8ung.at/klappnase/TkinterDnD/TkinterDnD.html) that makes it possible to use tkdnd from python. If you need windows support, you can try a newer version of shape (http://www.cs.man.ac.uk/~fellowsd/tcl/shapeidx.html) that seems to suppo

[Tutor] lists strings and files

2005-11-09 Thread Michael Haft
Hello, thanks for all the help with lists and strings, the list I have has nested sublists in it though. How do I remove these or is there a way to convert from lists to strings without removing them? The code looks something like: result = [] data = [fields[1] fields[3] fields[7]] result.ap

Re: [Tutor] tkFileDialog.Directory

2005-11-14 Thread Michael Lange
.grab_set() but this raises an > attribute error. Here is a minimal example: > Hi Karsten, I guess the tkFileDialog.Directory class isn't intended to be used directly. Try tkFileDialog.askdirectory() instead. If there are problems with the grab state, try passing "parent

Re: [Tutor] tkFileDialog.Directory

2005-11-15 Thread Michael Lange
sage='ZeroDivisionError') ? Thank god python is nice enough to raise the error where it actually happens; imagine your example would work, you would never know *where* the error happened nor could you create adequate handlers for different exceptions in different situations. I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Creating Tkinter Menubars

2005-11-16 Thread Michael Lange
) menu.add_command(label="Paste") root.config(menu=menubar) root.mainloop() The only thing that looks a little starnge to me in the original code is that the menubar is created as a child of the AppUi class, which is basically a Frame, but then it is attached to th

Re: [Tutor] Tkinter mainloop (was Re: tkFileDialog.Directory)

2005-11-16 Thread Michael Lange
to quit itself Now most of the errors that occur happen of course on the python level and are caught by the python interpreter (that shows you the traceback) and there is no reason for python to inform the tk shell that it should quit. I hope this makes sense Michael __

Re: [Tutor] Is it a good idea to use TKInter to change my password program into a GUI?

2005-11-29 Thread Michael Lange
<http://pmw.sourceforge.net/doc/PromptDialog.html>) ? Regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Unicode trouble

2005-11-30 Thread Michael Lange
i in self.f.readlines(): > > en = i.split('\t')[0] > > The thing is, it's the line > for i in self.f.readlines(): > that is calling the codecs module, not the line > en = i.split('\t')[0] > but it is the latter line that is in the stack

Re: [Tutor] Is it a good idea to use TKInter to change my password program into a GUI?

2005-12-03 Thread Michael Lange
a number of links to Tkinter documentation there: <http://tkinter.unpythonic.net/wiki/Tkinter> And still the best resource on Tkinter programming is John Grayson's "Python and Tkinter programming": <http://www.manning.com/books/grayson> Regards Michael _

Re: [Tutor] tkFileDialog bug on windows

2005-12-03 Thread Michael Lange
ink on windows tk uses native dialogs, and maybe these respond to ButtonPress events; if this is the case, it may happen that the ButtonRelease occurs *after* the dialog window has been destroyed, so the event gets delivered to the button in the parent window. Regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Currency conversion

2005-12-12 Thread Michael Janssen
from_file functions. You can read about them and their relationship to the package in: http://docs.python.org/lib/node584.html regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter help required

2005-12-14 Thread Michael Lange
r is in a separate package that may be called "tkinter" or "python-tk" or something similar, depending on the distro. May be this package is not installed? Regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] First steps with Tkinter

2006-01-26 Thread Michael Lange
ainloop() and two of these cannot coexist in one process. I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Dictionaries

2006-01-27 Thread Michael Janssen
ss --> %%%ss' % (maxKey, maxValue) % (name, pairs[name]) for years. Thanks :-) Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Using ioctl

2006-02-02 Thread Michael Lange
in case it fails, but I don't have an idea "except *what*"). Any hints are much appreciated. thanks in advance Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] list method help

2006-02-02 Thread Michael Haft
loop to pop things from a list? or is there another way to do it? I also tried the following: list = ["1", "test", "1.5"] for x in list: print list.pop(0) which worked but returned the following: 1 test Why did it not return the last value in the li

Re: [Tutor] GUI Development - Which toolkit

2006-02-06 Thread Michael Lange
h is now included in python's windows installer (and also in any recent linux distro) and which adds a lot of nice extra widgets to Tkinter, like Combobox and Tree widget. A good place to find out more about Tkinter is the wiki: <http://tkinter.unpythonic.ne

Re: [Tutor] Changing instance attributes in different threads

2006-02-07 Thread Michael Lange
hought* this would be safe, but now reading this thread I start to doubt. Are there any pitfalls I overlooked in this technique? Thanks Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Changing instance attributes in different threads

2006-02-07 Thread Michael Lange
data = [x for x in self.recbuffer] self.recbuffer = [] self.rec_locked.release() for d in data: self._waveobj.writeframesraw(d)# write the data to a file Thanks Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Changing instance attributes in different threads

2006-02-08 Thread Michael Lange
On Tue, 7 Feb 2006 23:31:06 +0100 Michael Lange <[EMAIL PROTECTED]> wrote: > > So I think I need two Condition objects here; it is most important here that > thread 1 does not > block to minimize the risk of recording buffer overruns, but from reading the > docs I am

Re: [Tutor] Changing instance attributes in different threads

2006-02-08 Thread Michael Lange
from the main loop to poll a threading Queue that your thread writes). I have seen it suggested that a thread can safely use event_create to communicate with the main thread, but have found this is not safe. I guess I have to spend a second thought at this. Thanks again Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Changing instance attributes in different threads

2006-02-08 Thread Michael Lange
re > calling get_peaks() from a scheduled Tkinter task (scheduled with > after() or after_idle()) you will be fine. > Yes, that's what I am doing. I think I just was confused because I did not understand what the Condition class does. Now I think I see clearer, thanks for all your help. Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Changing instance attributes in different threads

2006-02-09 Thread Michael Lange
is lock. > Ah , then I misunderstood what the docs meant with "return an item if one is immediately available, else raise the Empty exception". I thought "immediately available" means the Queue is currently not locked by another thread. Thanks again Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] lists

2006-02-14 Thread Michael Haft
, '10.00', '8.80'] I'm confused because if I try it without the for loop, i.e.: x = 3 p[x] = float(p[x])/10 print p It works just fine, I assume it doesn't like me floating the value but why does it work out of the loop but not in the loop?

[Tutor] map vs. list comprehension

2006-02-14 Thread Michael Broe
I read somewhere that the function 'map' might one day be deprecated in favor of list comprehensions. But I can't see a way to do this in a list comprehension: >>> map (pow, [2, 2, 2, 2], [1, 2, 3, 4]) [2, 4, 8, 16] Is there a way? Cheers, Mike ___

Re: [Tutor] map vs. list comprehension

2006-02-14 Thread Michael Broe
On Feb 14, 2006, at 3:46 PM, Andre Roberge wrote: > [2**i for i in [1, 2, 3, 4]] Ah yes, I'm sorry, I was thinking of the most general case, where the arguments are two arbitrary lists. My example was too specific. Is there a way to do something like the following in a list comprehension?

Re: [Tutor] map vs. list comprehension

2006-02-14 Thread Michael Sparks
On Tuesday 14 February 2006 20:57, Michael Broe wrote: ... > But I can't see a way to do this in a list comprehension: > > >>> map (pow, [2, 2, 2, 2], [1, 2, 3, 4]) > [2, 4, 8, 16] >>> [ x**y for x,y in zip([2,2,2,2],[1,2,3,4]) ] [2, 4, 8, 16] To me this

Re: [Tutor] G'day

2006-02-15 Thread Michael Lange
t a guess, maybe the example later in the book looks rather like: print 'I say "Hello world"' or print "You say 'Goodbye world'" ? In python you can use both single (') or double (") quotes to delimit a string, but you need to use the same char

[Tutor] Unexpected behavior of +=

2006-02-15 Thread Michael Broe
I just discovered the following behavior, but can't find any documentation about it: >>> list = [] >>> list = list + 'abc' Traceback (most recent call last): File "", line 1, in ? TypeError: can only concatenate list (not "str") to list but: >>> list = [] >>> list += 'abc' >>> list ['a

[Tutor] 'in-place' methods

2006-02-17 Thread Michael Broe
I think I understand this sorting-a-list 'in place' stuff, and things of that kind (reversing for example); but I am finding it very difficult to get used to, since sorting a list doesn't return the sorted list as a value, but simply does the work as a side effect. The place where it really

Re: [Tutor] Tkinter, Frame and Canvas question.

2006-02-24 Thread Michael Lange
kness is the width of the border around the widget that becomes black when the widget has keyboard focus and it probably defaults to 1. If you set highlightthickness to 0 you should probably also set takefocus to False (if this is an option for you). I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python and unicode

2006-03-10 Thread Michael Lange
unicode-proof (i don't know about sax though). You will have to encode these strings again when calling these module's functions. If your program is supposed to run on different systems it may help to know the encoding the system uses if you want to r

[Tutor] Unicode and regexes

2006-03-10 Thread Michael Broe
Does Python support the Unicode-flavored class-specifications in regular expressions, e.g. \p{L} ? It doesn't work in the following code, any ideas? - #! /usr/local/bin/python """ usage: ./uni_read.py file """ import codecs import re text = codecs.open(sys.argv[1], mode='r', encoding='u

Re: [Tutor] Unicode and regexes

2006-03-11 Thread Michael Broe
Thanks Kent, for breaking the bad news. I'm not angry, just terribly, terribly disappointed. :) "From http://www.unicode.org/unicode/reports/tr18/ I see that \p{L} is intended to select Unicode letters, and it is part of a large number of selectors based on Unicode character properties." Yeah,

Re: [Tutor] Test If File System is mounted in Linux

2006-03-17 Thread Michael Lange
e one I am looking for is > in the list. While I could replicate this with > Python, I am curious if there is an easier way. > Hi Fortezza, try os.path.ismount() . HTH Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fill in a web form

2006-03-18 Thread Michael Janssen
uot;post" data). Perhaps urllib.urlencode is of interest for you (before generating a get-url, urlencode the data, so that it renders a sane url). This answere is a bit short and might leaves you with a lot of open questions. If so, ask :-) regards Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Simple way for i18n ?

2006-03-23 Thread Michael Lange
'messages' > >>> > Hi Francois, not sure if it is different on windows, on linux I simply do: import gettext gettext.install(domain, localedir) to install _() into my application's global namespace, where localedir in your case was "c:\myappfolder\Translations". The path that contains the french translation should be "..\fr\LC_MESSAGES" instead of "..\francais\LC_MESSAGES" I think (at least that is true on linux). I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Simple way for i18n ?

2006-03-24 Thread Michael Lange
ext.py", line 480, in translation > raise IOError(ENOENT, 'No translation file found for domain', domain) > IOError: [Errno 2] No translation file found for domain: 'myapp' " > > I find it strange that "install" finds it but not "translation&

Re: [Tutor] Turnkey Python on a USB stick

2006-03-27 Thread Michael Sparks
d to say it sounds like an EXCELLENT idea, and I'd be interested in hearing how you get on! :) Michael. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Bigrams and nested dictionaries

2006-03-28 Thread Michael Broe
I'm playing with the whole idea of creating bigram (digram?) frequencies for text analysis and cryptographic and entropy analysis etc (this is as much an exercise in learning Python and programming as anything else, I realise everything has already been done somewhere somehow :) Though I *a

Re: [Tutor] Bigrams and nested dictionaries

2006-03-28 Thread Michael Broe
Well I ran into an interesting glitch already. For a dictionary D, I can pull out a nested value using this syntax: >>> D['b']['a'] 23 and I can assign to this dictionary using >>> D['d'] = {'a':7, 'b':0'} but I can't assign like this: >>> D['d']['c'] = 1 TypeError: object does not suppor

Re: [Tutor] Bigrams and nested dictionaries

2006-03-28 Thread Michael Broe
Aha! John wrote: "Are you sure you haven't mistakenly assigned something other than a dict to D or D['d'] ?" Thanks for the tip! Yup that was it (and apologies for not reporting the problem more precisely). I hadn't initialized the nested dictionary before trying to assign to it. (I think P

Re: [Tutor] Bigrams and nested dictionaries

2006-04-03 Thread Michael Broe
Well coming up with this has made me really love Python. I worked on this with my online pythonpenpal Kyle, and here is what we came up with. Thanks to all for input so far. My first idea was to use a C-type indexing for-loop, to grab a two- element sequence [i, i+1]: dict = {} for i in rang

Re: [Tutor] ossaudiodev, pygtk, and flushing buffers

2006-05-11 Thread Michael Lange
close() and the actual stopping of playback, (which can be avoided by calling self.dsp.reset() before self.dsp.close()), however this should not be a problem if you play the file to the end, I think. I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] help with erros using subprocess module

2006-05-12 Thread Michael Lange
On Thu, 11 May 2006 10:59:19 -0700 (PDT) Jerome Jabson <[EMAIL PROTECTED]> wrote: > > Am I missing some module you are referencing with > "types"? > Hi Jerome, that's right, try import types first. Michael ___

Re: [Tutor] laying out a menu widget inside a frame

2006-05-12 Thread Michael Lange
e menu to be inside the "lightblue", "RIDGE" part of the window, try: root.config(relief=RIDGE, bg="lightblue", bd=3) and relief="flat", bg="lightblue" on the frame. I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] laying out frames

2006-05-15 Thread Michael Lange
o, so I recommend to think twice if you really need its capabilities. With place() you can define absolute or relative x ynd y coords of a widget in its container and relative or absolute dimensions, e.g: from Tkinter import * root = Tk() Label(root, text='Label1', bg

Re: [Tutor] laying out a menu widget inside a frame

2006-05-16 Thread Michael Lange
in pack_configure self.tk.call( TclError: can't pack ".135695884.135828540": it's a top-level window It seems like the Pmw.MenuBar widget can do what you want: >>> mb =Pmw.MenuBar(frame) >>> mb.pack(side='top&#

Re: [Tutor] combo box

2006-06-07 Thread Michael Lange
rt * You then can use your Tknter widgets as usual, plus a nice set of extra widgets (ComboBox, NoteBook, DirTree etc.) . I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] An Introduction and a question

2006-06-09 Thread Michael Sullivan
My name is Michael Sullivan. I am a 26 year-old college student in Oklahoma. My wife and I have a small (three PCs) computer network that we operate out of our home. We have our own domain (as one could tell by examining my email address) I have novice-level experience with VB, C/C++, Java, and

Re: [Tutor] An Introduction and a question (continuing)

2006-06-09 Thread Michael Sullivan
OK. I've got it working this far. Now I want the script to generate eight pieces, each with a random colour. Here's my current code: #!/usr/bin/env python import random import time import math class LinePuzzlePiece: """This class defines a single playing piece for LinePuzzle""" def __in

Re: [Tutor] An Introduction and a question

2006-06-10 Thread Michael Sullivan
On Sat, 2006-06-10 at 03:27 +0100, Jonathon Sisson wrote: > Michael Sullivan wrote: > > Here's the situation: My wife likes to play the game Chuzzle, found at > > Yahoo Games. We use primarily Linux, however Chuzzle is written as an > > ActiveX control, which only wor

Re: [Tutor] connect to a remote machine - Linux

2006-06-11 Thread Michael Sullivan
On Sun, 2006-06-11 at 15:19 +, Patricia wrote: > Hi All, > > I need to connect to a remote computer on the same network to store data into > its mysql database, and I need to do this using python script. > > Although I've used mysql and python before, I have no idea how to access a > remote

Re: [Tutor] assignment statements in python

2006-06-12 Thread Michael Sullivan
On Sun, 2006-06-11 at 22:14 -0400, Kermit Rose wrote: > Message: 1 > Date: Sun, 11 Jun 2006 06:58:39 -0400 > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] buggy bug in my program > Cc: tutor@python.org > > Assignment in Python is not a copy, it is a name binding. Assignment > cr

Re: [Tutor] Python related mags

2006-06-12 Thread Michael Sullivan
On Mon, 2006-06-12 at 21:13 -0400, Andrew Robert wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Now that is a real pity. > > Wish I were talented enough to do it myself. Someone could do something like Tux Magazine (http://www.tuxmagazine.org/) . Each month they put out a free Lin

Re: [Tutor] Python related mags

2006-06-13 Thread Michael Sullivan
On Tue, 2006-06-13 at 16:49 +, ingo wrote: > in news:[EMAIL PROTECTED] Evans Anyokwu wrote: > > > But then again, who is going to initiate the first move?? > > > > Here's a name: Monthly Python Yes. They had a large influence in the birth of the language, but I'm not so sure if they still

Re: [Tutor] Beginner question(s)

2006-06-18 Thread Michael Sullivan
gt; > print i, > > > > but I just get the numeric values of the string. Can anyone help? > I'm a python beginner myself, but shouldn't that last "print i" be "print message[i]? As it stands, you're only printing the numeric value 'i

Re: [Tutor] abs beginner first project

2006-07-12 Thread Michael Lange
'Hi', command=lambda widget=b: test(widget)) >>> b.pack() Now when you press the button, you get: >>> (,) >>> so the callback actually "knows" which widget called it, and you could easily perform differe

Re: [Tutor] List Box binding

2006-07-19 Thread Michael Lange
) elif var.get() == 'b': # button with value 'b' selected do_that() (etc.) radio_a = Radiobutton(parent, variable=var, value='a', command=radio_command) radio_b = Radiobutton(parent, variable=var, value='b', command=radio_command

Re: [Tutor] [tutor] how to get the fileextention?

2006-07-20 Thread Michael Lange
perations, you should have a look at the os.path module. In your case os.path.splitext(fname)[1] should do the trick, or if you need to remove the leading period from the extension (as in your example) os.path.splitext(fname)[1][1:] . I hope this helps Michael __

Re: [Tutor] Help me make it look pretty!

2006-07-21 Thread Michael Lange
alidation of input based on programmable functions. Sample functions included in the package provide validation for integers, floats, non-empty strings, ISBN numbers, phone numbers, money and bounded values (e.g., integers in a range). A demo app is included in the package. The latest version, 1.0.4, can be downloaded here. Good luck! Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] : finding out if the horizontal scrollbar on a Tix.CheckList is being used or not

2006-07-21 Thread Michael Lange
emely grateful :-). > Hi Orri, how about check_list.hsb.get() ? I think in case it is != (0.0, 1.0) the scrollbar should be visible. I hope this helps Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] : finding out if the horizontal scrollbar on a Tix.CheckList is being used or not

2006-07-22 Thread Michael Lange
still > stuck. > I think the tkFont module has what you need: >>> from Tkinter import * >>> l=Label(text='hi') >>> l.pack() >>> import tkFont >>> f=tkFont.Font(family='helvetica', size='-14') >>> l.config(font=f

Re: [Tutor] Listbox selection

2006-08-04 Thread Michael Lange
uestion is here, maybe you want to try something like (untested): var = StringVar() var.set('Steel') listbox = Listbox(root) listbox.pack(side=LEFT, fill=BOTH) metals = {'Aluminum' : ['Wrought', 'Die cast'],

Re: [Tutor] Multiple buttons, One callback (fwd)

2006-08-04 Thread Michael Lange
> -- Forwarded message -- > Date: Fri, 4 Aug 2006 09:32:48 -0700 (PDT) > From: Michael Cochez <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: Multiple buttons, One callback > > Hi Danny, > I've just been reading your reply on this

Re: [Tutor] IDLE Crashing

2006-08-05 Thread Michael Meier
perience the same problem as I? Is there a common solution to Adams and my problems? Thanks, Michael Meier P.S. I'm new to this list... I think its a very interesting and friendly place to be :) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] i18n Encoding/Decoding issues

2006-08-10 Thread Michael Lange
icode. This will obviously only work as expected if the original string is actually latin-1. In order to safely convert the message body into utf-8 you would have to find out which encoding is used for the message and then do unicode(body, original_encoding).encode('utf-8')

<    1   2   3   4   5   6   7   8   9   >