[Tutor] A tutorial for Python and QT4

2008-11-12 Thread Robert Berman




Hi,

I am looking for a tutorial teaching how to use QT4 Designer with
Python. There are a number of very good tutorials for QT3, but I do not
want to drop back from QT4.I have no problem designing the form(s)
using QT4 designer; including signals and slots; but..I am not even
certain why the form has to be saved as a .ui file rather  than a .frm
file. I have no idea how to generate the python shells I can use to
fill in the code for my defined events and the lack of a really good
tutorial or two  is certainly placing me under a real handicap.

Any pointers, literally, to some tutorials would be most appreciated.

I am using  Linux (ubuntu -- 8.10) with Eric as my editor.

Thanks,

Robert 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Running a script from another folder

2008-11-12 Thread ycbh7f302
Suppose I have a python script in /usr1/myID/bin and I want to run it from 
another folder. If I enter

python ~myID/bin/myscript

that works. Is there a way to get by with 

python myscript

or even

myscript.py

I've tried specifying the PYTHONPATH 
environmental variable but it seems to be used only for importing modules.





___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Running a script from another folder

2008-11-12 Thread W W
On Wed, Nov 12, 2008 at 10:27 AM, <[EMAIL PROTECTED]> wrote:

> Suppose I have a python script in /usr1/myID/bin and I want to run it from
> another folder. If I enter
>
> python ~myID/bin/myscript
>
> that works. Is there a way to get by with
>
> python myscript
>
> or even
>
> myscript.py
>
> I've tried specifying the PYTHONPATH
> environmental variable but it seems to be used only for importing modules


it looks like you're on linux - so at the beginning of your script put
#!/usr/bin/env python (I believe) and then chmod +x myscript.py

then you can call it from the command line.

Alternatively you could create a shell script that would execute it with
python.

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Running a script from another folder

2008-11-12 Thread greg whittier
> it looks like you're on linux - so at the beginning of your script put
> #!/usr/bin/env python (I believe) and then chmod +x myscript.py
>
> then you can call it from the command line.
>

You'll also need to make sure ~myID/bin is in your PATH.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python and Abaqus

2008-11-12 Thread iSinhCanon
It would be simply if you can use Python to explorer your file .odb for yours 
databases for exemples: displacements and stresses at node etc...

I have a lot of exemples by using Python for file .odb, if you want i can send 
it to you.

Sinh.


Hello folks,

This is something that must have been asked several times. I want to post
process data obtained after running a FEM in ABAQUS. The requested results
are usually printed to the .dat file or .rpt file. I would like to learn how
to extract the information that I need (i.e. displacements and stresses at
the nodes) from this file using Python. The fact is that I am kind of new at
ABAQUS and have zero knowledge about Python. Therefore, any help with
websites, examples, tutorials, etc. would be appreciated.

Thank you!

Andres


  ___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Running a script from another folder

2008-11-12 Thread Shawn Milochik
On Wed, Nov 12, 2008 at 12:58 PM, greg whittier <[EMAIL PROTECTED]> wrote:
>> it looks like you're on linux - so at the beginning of your script put
>> #!/usr/bin/env python (I believe) and then chmod +x myscript.py
>>
>> then you can call it from the command line.
>>
>
> You'll also need to make sure ~myID/bin is in your PATH.
> _

This is the answer, assuming you have the shebang line and executable
flags mentioned above.

Method (assuming you are using bash):

Add this to your .bashrc file in your home directory:

export PATH=$PATH:${HOME}/bin

I used ${HOME} instead of ~ to make this more portable. However, if
your system doesn't work that way, use the ~ or the full path.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] get a module's own (top_level) dict?

2008-11-12 Thread Emile van Sebille

spir wrote:

Hello pyhonistas,

Example:
=== module content ===
a = 1
b = 2
==

I'm looking for a way to get something like {'a':a, b':2}. 


Maybe this will get you started:

[EMAIL PROTECTED] root]# cat > testmod.py
a=1
b=2
[EMAIL PROTECTED] root]# python
Python 2.5 (r25:51908, Nov  1 2006, 15:36:22)
[GCC 2.96 2731 (Red Hat Linux 7.1 2.96-98)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import testmod
>>> dir(testmod)
['__builtins__', '__doc__', '__file__', '__name__', 'a', 'b']
>>> D=dict([(varname,getattr(testmod,varname))
for varname in dir(testmod)
if not varname.startswith("_") ])
>>> D
{'a': 1, 'b': 2}
>>>

HTH,

Emile


Actually, 
names defind in the module will be instances of a custom type. I want to 
give them an attribute that holds their own name. E.g.:

for key,obj in dict:
obj.name = key
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Documentation on how to run complete R scripts from Python interpreter

2008-11-12 Thread Judith Flores
Hello,

   I am very new to Python and I have long R scripts that I would like to run 
under the Python Interpreter. The reason for this is because I will try to 
construct a GUI using 'easygui' in Python. I read some of the the documentation 
regarding the RPy module, but it implies to add a 'r' at the beginning of every 
R function, plus the dot to underscore conversion in the names of the R 
functions. Or maybe, what I am intending to do is not possible? I originally 
built a GUI using Rtcltk, but easygui honors its name, and I need to add some 
text manipulation also, which is much more intuitive to do in Python than R.



This is a diagram of what I would like to do:

GUI constructed with "easygui" --> this will retrieve pathfiles and user's 
preferences (floating numbers and strings) --> The preceeding attributes will 
feed the R scripts-->R scripts will generate pdf files with plots.

All this within the Python Interpreter, although I am suspecting that like the 
name indicates, this is only a 'Python' interpreter, nothing else...

   If you could orient me to where I can find documentation on what I would 
like to do, I would appreciate it very much.

Thank you,

Judith


  
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Documentation on how to run complete R scripts from Pythoninterpreter

2008-11-12 Thread Alan Gauld
"Judith Flores" <[EMAIL PROTECTED]> wrote 

  I am very new to Python and I have long R scripts that I 
would like to run under the Python Interpreter. 


I'm sorry I can't help for reasons that will become apparent.

But I'd like to thank you for pointing me at R!
I've just bought a commercial statistics package(Minitab) which 
cost me over $150, and it looks as if R could have done all I 
needed for free - or maybe the cost of a book...


some of the the documentation regarding the RPy module, 


I haven't read anything about RPy so can't help there (yet) 
but it did lead me to the R web site.


GUI constructed with "easygui" --> this will retrieve pathfiles 
and user's preferences (floating numbers and strings) 
--> The preceeding attributes will feed the R scripts-->R scripts 
will generate pdf files with plots.


It sounds like you could do this by just creating the scripts 
in vanilla Python then running the R scripts under R itself 
from Python usiing os.system or the Subprocess module.


Once I've investigated R and RPy a bit more I might be able 
to help, but that will be a whjile... I hope someone else can 
shed some light meantime.


Thanks again,

--
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] Documentation on how to run complete R scripts from Pythoninterpreter

2008-11-12 Thread Kent Johnson
On Wed, Nov 12, 2008 at 6:07 PM, Alan Gauld <[EMAIL PROTECTED]> wrote:
> "Judith Flores" <[EMAIL PROTECTED]> wrote
>>
>>  I am very new to Python and I have long R scripts that I would like to
>> run under the Python Interpreter.

> But I'd like to thank you for pointing me at R!

R is very powerful. I found it a bit opaque at first. You will
probably want a book :-)
You might be interested in these notes, which basically tell how to
use R to do first-semester college statistics:
http://personalpages.tds.net/~kent37/stories/00019.html

>> some of the the documentation regarding the RPy module,

I have not had any luck with RPy myself though presumably others have
more success. The r() function might let you execute your scripts:
http://rpy.sourceforge.net/rpy/doc/rpy_html/Miscellaneous.html#Miscellaneous

> It sounds like you could do this by just creating the scripts in vanilla
> Python then running the R scripts under R itself from Python usiing
> os.system or the Subprocess module.

I think that is probably the easiest approach if you can pass the
script parameters on the command line.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A tutorial for Python and QT4

2008-11-12 Thread Timothy Grant
On Wed, Nov 12, 2008 at 6:50 AM, Robert Berman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am looking for a tutorial teaching how to use QT4 Designer with Python.
> There are a number of very good tutorials for QT3, but I do not want to drop
> back from QT4.I have no problem designing the form(s) using QT4 designer;
> including signals and slots; but..I am not even certain why the form has
> to be saved as a .ui file rather  than a .frm file. I have no idea how to
> generate the python shells I can use to fill in the code for my defined
> events and the lack of a really good tutorial or two  is certainly placing
> me under a real handicap.
>
> Any pointers, literally, to some tutorials would be most appreciated.
>
> I am using  Linux (ubuntu -- 8.10) with Eric as my editor.
>
> Thanks,
>
> Robert
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>

It's been a long time since I played with Qt, but I firmly believe you
need to learn how to code the GUI first before you start playing with
the tools that will code the GUI for you. You'll have a much stronger
understanding of how things work and fit together if you know how to
code it all.

-- 
Stand Fast,
tjg.  [Timothy Grant]
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] experience/opinions with deploying python GUI app to Linux, Win32, and Mac OS X

2008-11-12 Thread greg whittier
Hi gang,

I know this is probably like asking whether vi or emacs is better, but I'm
looking for the best cross-platform (linux, windows, mac os x) user
interface toolkit.  Since the users won't be programmers, I'd like it to
feel as much like a native app as possible in terms of installation.  It
should feel like installing any other mac/windows/linux application.

I'm writing a very simple app to retrieve data from a device or import it
from a file and then upload that data to a website (and possibly keep a
local backup of the data using sqlite or similar).The main widget will
be what in gtk would is called listview with a checkbox column for selecting
which data to upload possibly as a panel within a wizard that would also
have panels for selecting the device and logging into the web site.

Deploying to the Mac seems to be the most difficult from what I've read.
pygtk/glade seems natural for linux and even window, but 've read about
difficulties with gtk on the mac, which at one point required installing
X11, I believe.  There's a "native" (no X11) port, but I'm not sure how
mature that is.

Here's what I've thought about with some pros/cons:

- tkinter -- this is the obvious answer I suppose, but the widget set is
limited and not pretty (out of the box at least)
- pygtk -- not easy to deploy on mac?  Non-native looking widgets
- wxpython - complete widget set and native looking, but not sure if it's
easy to deploy
- jython/SWT -- I have no experience with this, but everybody has a JVM, so
deploying should be easy
- web app running locally -- no experience with this, but everybody has a
web browser and there are frameworks like django I could use
- curses -- probably not as pretty as mac/windows users would expect

Any success stories out there?

Thanks,
Greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] experience/opinions with deploying python GUI app to Linux, Win32, and Mac OS X

2008-11-12 Thread W W
On Wed, Nov 12, 2008 at 9:03 PM, greg whittier <[EMAIL PROTECTED]>wrote:

> - web app running locally -- no experience with this, but everybody
> has a web browser and there are frameworks like django I could use
> - curses -- probably not as pretty as mac/windows users would expect
>

I'd probably roll with the web-app, especially if you're worried about it
looking "native". GTK can look like windows, but you mentioned difficulty on
macs. Of course I've never had my GTK apps /really/ look native on windows.

For the reason you mentioned, I probably wouldn't use curses, unless you're
not worried about it looking particularly "pretty".

However, with some type of web framework, you can easily make it look the
same cross-platform, with minimal maintenance and customizing (mainly only
required if you use CSS and any client runs IE).

Anyhow, that's just my 2¢
-Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor