[Tutor] Installing twisted
Hi all, I have been trying to install the zope interface as part of the twisted installation with no luck. Any suggestions ? Sent from my iPad ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Understanding code line
Pythonists I am trying to understand the difference between a = b b = a + b and a,b = b, a+ b When used in my Fibonacci code the former generates 0,1,2,4,8,16,32 and the later Generates 0,1,1,2,3,5,8,13,21,34,55,89. The second is the sequence I want, but I would Like to understand the second code sequence better so I can write the code in R and Scilab as well as python. G ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] (no subject)
Dear Pythonists Here is the code def fiba(n): a = 0 b = 1 while a n : print(a) c = a + b a = a +c # 0,1,3,7,15,31,63 def fibc(n): a = 0 b = 1 while a n : print(a) a, b = b,a + b #0,1,1,2,3,5,8,13,21,34,55,89 def fibb(n): a + b a = 0 b = 1 while a n : print(a) a = b b = a+b #0,1,2,4,8,16,32,64 I am trying to understand function fibc code line a,b = b, a + b and would like to see it written line by line without combining multiply assignment. If possible. I sort of follow the right to left evaluation of the other code.___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Fib sequence code assignment
Dear Jerry, Thank you so much, once you see it it seems so clear, but to see it I might as well be in the Indian Ocean. Got kinda close using temporary variable,but didn't know enough to use del. A lesson learn. Sent from my iPad ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Books for Learning Python
On Jan 11, 2013, at 1:39 PM, Alan Gauld alan.ga...@btinternet.com wrote: On 11/01/13 14:10, Chris Rogers wrote: Hello all, I've began my journey into Python (2.7 currently) and I'm finding it a bit rough using the python.org http://python.org tutorials. You don't tell us your starting point. Are you experienced in programming in other languages or is python your first foray into Programming? Are you a professional or hobbyist? Do you have a scientific or math background? All of these influence what makes a book suitable. Some of the tutorials listed on Python.org are also paper books (including mine). Which tutorials have you looked at? The official tutor is good for people who can already program. The non-programmes ones are better if you can't already program (as you'd expect!). There are also several python videos available on sites likeshowmedo.com If you can answer the above questions we might be able to recommend some books. I am also looking for some good resources for learning Python. Here is my background. I did a lot of programming in Fortran 77 while working on my Ph.D. in engineering mechanics (graduated in 1993). I did some simple programming in Matlab and Mathematica in the 90s, but all the coding for my research since then has been done by my graduate students. I want to get back into programming so that I can create applications and animate the motion of objects for undergraduate and graduate dynamics courses I teach. Friends tell me Python is a good choice for an object oriented language (about which I know almost nothing) that has a readable syntax. With this in mind, I have two questions: (1) Will Python allow me to create applications that provide a simple GUI interface to something like an integrator for ODEs? Does it have graphics libraries that allow one to animate the motion of simple objects (e.g., spheres, ellipsoids, parallelepipeds, etc.) based on the results of numerical simulations? (2) If the answers to the above questions are generally yes, where are some good places to get started learning Python to achieve my goals? Thank you. Gary L. Gray ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] new to python
Dear Python Tutor, Being new to python I was wondering if there is a way to import exel data into pyrhon matrix/arrays so that I have some data to work with. I know R uses Rcmdr as an easy interface for excel data, which helps keep the reader engaged while learning the language. Thanks G ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] SetTopWindow
I have what is a noob's confusion about this that will lead to bigger problems for me later on if I don't clear it up. In wxPython what a user normally refers to as a window is known as a frame. And what is known in wxPython as a window is an object such as a TextCtrl object. At least that is what I take from wxPython in Action. Now, wxApp has a method called SetTopWindow and you normally pass your wxframe object to it so that it knows what is to be top object. class MyApp(wx.App): def OnInit(self): frame = MyFrame(blah, blah, blah, blah) frame.Show() frame.SetTopWindow(frame) return True class MyFrame(wx.Frame): def __init__(self, blah, blah, blah): wx.Frame.__init__(self, blah,blah,blah) My question, and it's probably a stupid question, is why is SetTopWindow, in how it is named, referring to a window object rather than a frame object? Isn't SetTopWindow saying which frame should be the top frame object? The naming of it seems really ambiguous to me. Why isn't it named something like SetTopFrame? What am I missing? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] application with tabs
Hi, I'm new to any kind of application development, but have done some python scripting. What I'm doing is creating an application for a non-profit social services organization that will allow them to track the services they give their clients. My plan so far was to use tabs for the different functions of the application such as entering data into the database, viewing data, and running reports. I'm running into problems combining tabs with multiple data fields and buttons. I can create multiple fields(text boxes) with wxFrame and wxPanel, but when using wxNotebook to create tabs only the last text box in each tab shows up. Say I have 3 text boxes, only the third one shows up. If I comment it out the second one shows up. I have a very similar problem with buttons. I have read and experimented with the examples on wxpywiki with no joy. Using the following example from wxpywiki the text boxes created in the TabPanel class are shown on every tab. When moving the text box creation to the NotebookDemo class, so that I can have different types/numbers of text boxes on each tab, I run into the problem of having more than one text field displayed in each tab. The first code example is the one I'm using. http://wiki.wxpython.org/Notebooks Am I going about creating this application interface in the most difficult way? Is there a better/easier way to create multiple application views in the same window? Can anyone recommend good books, tutorials, etc...? I'm doing this on an i386 install of Debian and have python-wxgtk2.8 installed as well as libwxgtk2.8. The version of python itself is 2.5.5. All related packages are Debian packages. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Beginners question
Hi all - Just started on Python Programming for Absolute Beginners and I've got a question: The program called 'Guess my Number' goes like this: # Guess My Number # # The computer picks a random number between 1 and 100 # The player tries to guess it and the computer lets # the player know if the guess is too high, too low # or right on the money #import random print \tWelcome to 'Guess My Number'! print \nI'm thinking of a number between 1 and 15. print Try to guess it in as few attempts as possible.\n import random # set the initial values the_number = random.randrange(15) + 1 guess = int(raw_input(Take a guess: )) tries = 1 # guessing loop while (guess != the_number): if (guess the_number): print Lower... else: print Higher... guess = int(raw_input(Take a guess: )) tries += 1 print You guessed it! The number was, the_number print And it only took you, tries, tries!\n raw_input(\n\nPress the enter key to exit.) So here's the question - the original code has parentheses around the lines of code with *(guess !=the_number)* and *(guess* * the_number)* . I tried to run the program without the parentheses and it runs just fine. So what are the parentheses for?? Thanks a lot for your time - Gary ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Passing command line argument in function
ftp.storbinary(stor file_to_transfer, open(file_to_transfer,r)) You need to create the command as a string: ftp.storbinary(stor + file_to_transfer, open(file_to_transfer,r)) Kent That worked perfectly, I was way off. Thank-you! Gary p.s. sorry for the out of thread message, my mail seems to be having problems. -- [EMAIL PROTECTED] SDF Public Access UNIX System - http://sdf.lonestar.org ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Passing command line argument in function
I'm trying to pass the name of a file as the first argument to the ftp.storbinary function(?) below. The only thing I can get to work is the real file name hard coded as the argument. I've tried parenthesis, single quotes, double quotes, and many combinations of the previous. I've tried passing sys.argv[1] directly as well, although with fewer experiments. I invoke this as below and the output is what I would expect, but the file name on the ftp server is never correct. What is the correct way to do this? $ ./garyftp.py align.ps align.ps --- Python 2.3.4 on Linux. --- #!/usr/bin/python import sys from ftplib import FTP file_to_transfer = sys.argv[1] ftp = FTP() ftp.connect(myserver) ftp.login(myusername, mypasswd) ftp.storbinary(stor file_to_transfer, open(file_to_transfer,r)) print file_to_transfer ftp.quit() -- Thanks, Gary [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor