[Tutor] (no subject)
What is python language and what are its adventages Thank you, Swathi Chinta ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] (no subject)
First write the proper "subject". > What is python language and what are its adventages Answer is in http://www.python.org/ -- Thanks & Regards, goldgod ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] war cards
hello all, i have been rolling the idea of writing a simple script to play the classic card game war. i thought it would be good for me because their is no skill in the game. while thinking of how to write it i got stuck on one bit, how do i make it so that their is one of each card and i can split them? any help would be great ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] PythonCard error checking
Hello everyone, I've just started trying PythonCard to build a simple GUI for a little application I'm writing. Just wondering if anyone knows the "proper" way to do some simple error checking: for example, I have a textField, and I wish to check that only integers within a certain range are entered into it. I know I can just enclose that block of code in a try .. except clause, just that I'm not sure what to do once I've caught say, a ValueError exception. It certainly would not be a fatal error and I would like to prompt the user to re-enter the value, but how should I return to that point of program execution? Any help from the PythonCard gurus would be appreciated. Happy holidays! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] war cards
max baseman wrote: > hello all, i have been rolling the idea of writing a simple script to > play the classic card game war. i thought it would be good for me > because their is no skill in the game. while thinking of how to write > it i got stuck on one bit, how do i make it so that their is one of > each card and i can split them? > I don't fully understand the question. Also on this list we aim to help you where you are stuck, and it is not clear where you are stuck. Have you written any code, or even outlined (designed) an approach? Show us what you tried or thought out then wew can help. FWIW in Python one would use a list to hold the cards. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PythonCard error checking
While I'm a user, I'm not a guru. Those are at: https://lists.sourceforge.net/lists/listinfo/pythoncard-users for pythoncard. I know a common technique is on a button event for the "ok" or "apply" button is to validate all the text fields in an exception safe setting. On exception exit the event handler make an error notice. You could even color the guilty text box text red then exit the event handler. Only if all the boxes make it through, do you actually process the input. GUI code often is...hairy...when done correctly. That's why is should be separated into its own files: to keep the hair out of your main program. --Michael On Dec 24, 2007 10:02 AM, Roy Chen <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I've just started trying PythonCard to build a simple GUI for a little > application I'm writing. > Just wondering if anyone knows the "proper" way to do some simple error > checking: > for example, I have a textField, and I wish to check that only integers > within a certain > range are entered into it. > > I know I can just enclose that block of code in a try .. except clause, > just that I'm not sure > what to do once I've caught say, a ValueError exception. It certainly > would not be a fatal > error and I would like to prompt the user to re-enter the value, but how > should I return to > that point of program execution? > > Any help from the PythonCard gurus would be appreciated. Happy holidays! > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Michael Langford Phone: 404-386-0495 Consulting: http://www.RowdyLabs.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] war cards
"max baseman" <[EMAIL PROTECTED]> wrote > it i got stuck on one bit, how do i make it so that their is one of > each card and i can split them? You can define the cards as a tuple of values and insert them into a list. You can use random.choice() to select a card fro the list. By applying that repeatedly you can split the list across multiple players hands(also lists) Is that what you mean? -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PythonCard error checking
"Roy Chen" <[EMAIL PROTECTED]> wrote > > I have a textField, and I wish to check that only integers > within a certain range are entered into it. Not sure about PythonCard but most GUI toolkits, including wxPython from which PythonCard is buil;t allow you to trap the entry of data(usually with onKeyPress events or similar) so that you can check the data as it is entered. You can then beep or highlight the text if it is of the wrong type. There will often be preconfigured entry boxes that automatically check for currency, date/time, numeric, password types etc I think there is a PythonCard mailing list which is likely to be a better source than the tutor list. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Telnet to Router/Switch
Hi everyone.. I have to make Telnet session with Router/switch of Cisco. Anybody has idea how it can be done? from what i researched, i got most of the telnet session like client/servers. But what I have to do here is just to create a Telnet session which writes the password when its prompted and then write the commands and fetch the result which is returned by the session. > From: [EMAIL PROTECTED]> Subject: Tutor Digest, Vol 46, Issue 60> To: > tutor@python.org> Date: Mon, 24 Dec 2007 12:00:06 +0100> > Send Tutor > mailing list submissions to> tutor@python.org> > To subscribe or unsubscribe > via the World Wide Web, visit> > http://mail.python.org/mailman/listinfo/tutor> or, via email, send a message > with subject or body 'help' to> [EMAIL PROTECTED]> > You can reach the > person managing the list at> [EMAIL PROTECTED]> > When replying, please edit > your Subject line so it is more specific> than "Re: Contents of Tutor > digest..."> > > Today's Topics:> > 1. Re: Output of list (J?nos Juh?sz)> 2. > Re: Output of list (Martin Walsh)> 3. Re: Output of list (J?nos Juh?sz)> 4. > Re: Output of list (Martin Walsh)> 5. Py2Exe Tutorial (TW)> > > > --> > > Message: 1> Date: Sun, 23 Dec 2007 17:52:28 +0100> From: J?nos Juh?sz > <[EMAIL PROTECTED]>> Subject: Re: [Tutor] Output of list> To: > tutor@python.org> Message-ID:> <[EMAIL PROTECTED]>> Content-Type: > text/plain; charset="US-ASCII"> > Dear Emil,> > > I want to be capable of > converting a string into a list where all > > the items, in the list, have a > fixed length not equal to 1 e.g i > > have k = 'abcdefgh' and I want the > fixed length for all the the > > items to be 2 then the list would look like > ['ab', 'cd', 'ef, 'gh'].> > How do i do this?> > > > > - Emil> > It is nice > place to use a generator:> > def pairs(sliceit):> streamlist = > list(sliceit)> streamlist.reverse()> while streamlist:> pair = > streamlist.pop() > try: pair += streamlist.pop()> except: pass> yield pair> > > ## Probably it is easier to understand> def pairs2(sliceit):> try:> while > sliceit:> yield sliceit[:2]> sliceit = sliceit[2:]> except: # oops, it was > odd length> yield sliceit> > > print '_'.join(e for e in pairs('abcd'))> > print '_'.join(e for e in pairs('abcde'))> print '_'.join(e for e in > pairs2('abcd'))> print '_'.join(e for e in pairs2('abcde'))> > > Best > Regards,> Janos> > > --> > Message: 2> Date: > Sun, 23 Dec 2007 13:40:13 -0600> From: Martin Walsh <[EMAIL PROTECTED]>> > Subject: Re: [Tutor] Output of list> Cc: tutor@python.org> Message-ID: > <[EMAIL PROTECTED]>> Content-Type: text/plain; charset=UTF-8> > J?nos Juh?sz > wrote:> > It is nice place to use a generator:> > > > def pairs(sliceit):> > > streamlist = list(sliceit)> > streamlist.reverse()> > while streamlist:> > > pair = streamlist.pop() > > try: pair += streamlist.pop()> > except: pass> > > yield pair> > > > ## Probably it is easier to understand> > def > pairs2(sliceit):> > try:> > while sliceit:> > yield sliceit[:2]> > sliceit = > sliceit[2:]> > except: # oops, it was odd length> > yield sliceit> > > > ... > Or, by extending Alan's solution ...> > def splitStringByN(s, n):> for m in > range(0, len(s), n):> yield s[m:m+n]> > k = 'abcdefghi'> > list(splitStringByN(k, 2))> > As it turns out, this is similar to an ASPN > Cookbook recipe contributed> by Dmitry Vasiliev:> > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302069> > HTH,> > Marty> > > --> > Message: 3> Date: Sun, 23 Dec > 2007 21:09:10 +0100> From: J?nos Juh?sz <[EMAIL PROTECTED]>> Subject: Re: > [Tutor] Output of list> To: tutor@python.org> Message-ID:> <[EMAIL > PROTECTED]>> Content-Type: text/plain; charset="US-ASCII"> > Dear Marty,> > > > >... Or, by extending Alan's solution ...> >> >def splitStringByN(s, n):> > > for m in range(0, len(s), n):> > yield s[m:m+n]> >> >k = 'abcdefghi'> > >list(splitStringByN(k, 2))> > It seems to be the most readable solution for > me.> > > >As it turns out, this is similar to an ASPN Cookbook recipe > contributed> >by Dmitry Vasiliev:> > >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302069> >> >HTH,> > >Marty> > Thanks for the link.> > > Best regards,> Janos> > > > --> > Message: 4> Date: Sun, 23 Dec 2007 > 14:53:43 -0600> From: Martin Walsh <[EMAIL PROTECTED]>> Subject: Re: [Tutor] > Output of list> To: tutor@python.org> Message-ID: <[EMAIL PROTECTED]>> > Content-Type: text/plain; charset=UTF-8> > J?nos Juh?sz wrote:> > Dear > Marty,> > Hi Janos,> > >> ... Or, by extending Alan's solution ...> >>> >> > def splitStringByN(s, n):> >> for m in range(0, len(s), n):> >> yield > s[m:m+n]> >>> >> k = 'abcdefghi'> >> list(splitStringByN(k, 2))> > > > It > seems to be the most readable solution for me.> > F
Re: [Tutor] Py2Exe Tutorial
>I am wondering if there is a good tutorial on Py2Exe and its functions? > I have not been able to find one. I have samples but that is not good > enough. It would be nice to have something explain all the functions for > including directories, modules and all that stuff when making an > executable. > >Bruce Don't know if there is one, but usually it is not necessary to explicitly tell py2exe to include directories, modules and all that stuff - dependencies are checked and automatically included. If you're talking about images, or other such binary data, it would be difficult. You would probably have to restructure your python code to load the binary data from a resource. I once had a setup.py that walked through the process of creating an executable (console or gui). I could send it if you're interested. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Telnet to Router/Switch
On Dec 24, 2007, at 1:19 PM, Shahjehan Hakim wrote: Hi everyone.. I have to make Telnet session with Router/switch of Cisco. Anybody has idea how it can be done? from what i researched, i got most of the telnet session like client/servers. But what I have to do here is just to create a Telnet session which writes the password when its prompted and then write the commands and fetch the result which is returned by the session. I would start with the telnetlib module: http://www.python.org/doc/current/lib/module-telnetlib.html It has a quick example too: http://www.python.org/doc/current/lib/telnet-example.html___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Telnet to Router/Switch
"Reed O'Brien" <[EMAIL PROTECTED]> wrote >> I have to make Telnet session with Router/switch of Cisco. > > I would start with the telnetlib module: > You might also be able to use the pyExpect module to good effect. Alan G ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] updates andcompletion of goals
Windows Wiki self instller with http server tinyweb: http://www.tinylist.org/WW140A.exe Full featured personal wiki for the travelling laptop user. TinyWeb server selfinstaller alone: http://www.tinylist.org/tinywebsetup193B.exe A good robust devlopment and personal server. Bon Yule, mon ami. -- Salute! -Kirk Bailey Think +-+ | BOX | +-+ knihT Fnord. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Py2Exe Tutorial
> From: [EMAIL PROTECTED]> To: tutor@python.org> Date: Sun, 23 Dec 2007 > 14:48:54 -0500> Subject: [Tutor] Py2Exe Tutorial> > > I am wondering if there > is a good tutorial on Py2Exe and its functions?> I have not been able to find > one. I have samples but that is not good> enough. It would be nice to have > something explain all the functions for> including directories, modules and > all that stuff when making an executable.> You might want to try using Andrea Gavana's GUI2Exe program, which allows using py2exe via a GUI interface. It's here: http://xoomer.alice.it/infinity77/main/GUI2Exe.html _ The best games are on Xbox 360. Click here for a special offer on an Xbox 360 Console. http://www.xbox.com/en-US/hardware/wheretobuy/___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor