[Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread Matthew Ngaha
Sorry for the forward, i forgot to reply to tutor On Mon, May 27, 2013 at 3:53 AM, Sunitha Misra sunith...@gmail.com wrote: self.fileDialog = QtGui.QFileDialog() QtCore.QObject.connect(self.toolButton, QtCore.SIGNAL(_fromUtf8(clicked())), self.fileDialog.getOpenFileName) i think the way

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread SM
Thanks! I defined a function, as you suggested, to call when the button was clicked. But then I also had to use self.fileDialog from within the function. Not sure how I could avoid using fileDialog. I also defined global variable (under the class) and assigned it to the filename, so I could

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread Matthew Ngaha
On Mon, May 27, 2013 at 2:14 PM, SM sunith...@gmail.com wrote: But then I also had to use self.fileDialog from within the function. Not sure how I could avoid using fileDialog. Thanks. No problem. to do it without the instance variable, you access its method directly. so replace: path =

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread SM
Yes, the following works. path = QtGui.QFileDialog.getOpenFileName() Thanks! On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha chigga...@gmail.com wrote: On Mon, May 27, 2013 at 2:14 PM, SM sunith...@gmail.com wrote: But then I also had to use self.fileDialog from within the function. Not

[Tutor] Buttons

2013-05-27 Thread Jack Little
Is there a way to make buttons a little like a raw_input in the context when the user presses the button, the program performs a function?___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread eryksun
On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha chigga...@gmail.com wrote: On Mon, May 27, 2013 at 2:14 PM, SM sunith...@gmail.com wrote: But then I also had to use self.fileDialog from within the function. Not sure how I could avoid using fileDialog. No problem. to do it without the instance

Re: [Tutor] Buttons

2013-05-27 Thread Alan Gauld
On 27/05/13 15:17, Jack Little wrote: Is there a way to make buttons a little like a raw_input in the context when the user presses the button, the program performs a function? Yes, but its a lot more complicated than raw_input. See the GUI topic of my tutorial for examples. Also check out

[Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Jim Mooney
I was looking at the bytecode doc page as a break from the Lutz book, since I like Assembler-type code due to its total non-ambiguity, but the page doesn't say much. Is there a doc somewhere that corresponds some of the bytecode to Python source? I thought rot_1, 2, 3, and 4 looked useful, but it

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Oscar Benjamin
On 27 May 2013 21:01, Jim Mooney cybervigila...@gmail.com wrote: I was looking at the bytecode doc page as a break from the Lutz book, since I like Assembler-type code due to its total non-ambiguity, but the page doesn't say much. Is there a doc somewhere that corresponds some of the bytecode

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Jim Mooney
Oscar Benjamin oscar.j.benja...@gmail.com What do you want these for? I've never needed to know what the interpreter's bytecodes are. I programmed A86 Assembler years ago, and just find the bytecode has a comfortable clarity as a learning tool, at least for me. When an author vaguely tried to

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Alan Gauld
On 27/05/13 21:21, Jim Mooney wrote: Oscar Benjamin oscar.j.benja...@gmail.com What do you want these for? I've never needed to know what the interpreter's bytecodes are. I programmed A86 Assembler years ago, and just find the bytecode has a comfortable clarity as a learning tool, To me,

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread SM
Thank you, for the details. On Mon, May 27, 2013 at 10:13 AM, eryksun eryk...@gmail.com wrote: On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha chigga...@gmail.com wrote: On Mon, May 27, 2013 at 2:14 PM, SM sunith...@gmail.com wrote: But then I also had to use self.fileDialog from within

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Devin Jeanpierre
On Mon, May 27, 2013 at 7:20 PM, Alan Gauld alan.ga...@btinternet.com wrote: Can you give a use case of how you think you could use them? There may be another way to do what you want. I can't speak for Jim, but I have used the dis module in the past to quickly check how python parsed an

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Steven D'Aprano
On 28/05/13 06:01, Jim Mooney wrote: I was looking at the bytecode doc page as a break from the Lutz book, since I like Assembler-type code due to its total non-ambiguity, but the page doesn't say much. Is there a doc somewhere that corresponds some of the bytecode to Python source? I thought

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread ALAN GAULD
I can't speak for Jim, but I have used the dis module in the past to quickly check how python parsed an expression (e.g. not x is y). Yes, I've done that too. But that's not the bytecodes (at least not what  I understand as bytecodes) that's the dis-assembly listing which is  usually far more

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Mark Lawrence
On 28/05/2013 00:32, Steven D'Aprano wrote: On 28/05/13 06:01, Jim Mooney wrote: Another question. I tried installing a package that back-compiles (in win 7), so I could see things that way, and got the error Unable to find vcvarsall.bat Shall we guess what package that is? I love guessing

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread Dave Angel
On 05/27/2013 07:56 PM, ALAN GAULD wrote: I can't speak for Jim, but I have used the dis module in the past to quickly check how python parsed an expression (e.g. not x is y). Yes, I've done that too. But that's not the bytecodes (at least not what I understand as bytecodes) that's the

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread eryksun
On Mon, May 27, 2013 at 4:01 PM, Jim Mooney cybervigila...@gmail.com wrote: I was looking at the bytecode doc page as a break from the Lutz book, since I like Assembler-type code due to its total non-ambiguity, but the page doesn't say much. Is there a doc somewhere that corresponds some of

[Tutor] a little loop

2013-05-27 Thread Tim Hanson
Okay, so I made it to FOR loops in the Lutz book. A couple of days ago I was helped here with the .join method for creating strings from lists or tuples of strings. I got to wondering if I could just, for the sake of learning, do the same thing in a FOR loop, since that's today's chapter:

Re: [Tutor] a little loop

2013-05-27 Thread kartik sundarajan
One way I can suggest is x=0; ham=''; b=['s','p','a','m'] #or, b=('s','p','a','m') for t in b: ham=ham+b[x] print(ham);x+=1 't' is actually equal to b[x] and its faster then indexed based look-up. so you can rewrite ham = ham + b[x] as ham += t and remove the x