new-style class or old-style class?

2012-09-25 Thread Jayden
In learning Python, I found there are two types of classes? Which one are 
widely used in new Python code? Is the new-style much better than old-style? 
Thanks!!
-- 
http://mail.python.org/mailman/listinfo/python-list


data attributes override method attributes?

2012-09-25 Thread Jayden
Dear All,

In the Python Tutorial, Section 9.4, it is said that

"Data attributes override method attributes with the same name."

But in my testing as follows:

#Begin
class A:
i = 10
def i():
print 'i'

A.i
   
#End

I think A.i should be the number 10 but it is the method. There must be 
something I misunderstand. Would you please tell me why?

Thanks,

Jayden


-- 
http://mail.python.org/mailman/listinfo/python-list


which a is used?

2012-09-24 Thread Jayden
Dear All,

I have a simple code as follows:

# Begin
a = 1

def f():
print a

def g():
a = 20
f()

g()
#End

I think the results should be 20, but it is 1. Would you please tell me why?

Thanks a lot!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pythonOCC examples doesn't work?

2012-09-12 Thread Jayden
On Wednesday, September 12, 2012 11:12:55 AM UTC-4, jelle wrote:
> You installed python 2.7 and expect a 2.6 module to work with it.
> 
> That won't work. Finally, you need to install the OpenCasCade libs to be able 
> to run PythonOCC.
> 
> 
> 
> -jelle

I think that is  the reason. Thanks a lot!!
-- 
http://mail.python.org/mailman/listinfo/python-list


pythonOCC examples doesn't work?

2012-09-11 Thread Jayden
I installed 
(1) pythonxy2.7.2.3 (with python2.7) and 
(2) pythonOCC-0.5-all-in-one.win32.py26 
on windows 7 64 bit computer. 

I try run pythonOCC examples in its example folder, such as the helloworld.py 
and got errors as follows: 

ImportantError: DLL load failed: The specified module could not be found. 

The error come from the line of code: 

from OCC.BrepPrimAPI import * 

How to fix the error? Thanks a lot!!
-- 
http://mail.python.org/mailman/listinfo/python-list


pythonOCC examples doesn't work?

2012-09-11 Thread Jayden
I installed 
(1) pythonxy2.7.2.3 (with python2.7) and
(2) pythonOCC-0.5-all-in-one.win32.py26 
on windows 7 64 bit computer.

I try run pythonOCC examples in its example folder, such as the helloworld.py 
and got errors as follows:

ImportantError: DLL load failed: The specified module could not be found.

The error come from the line of code:

from OCC.BrepPrimAPI import *

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python CAD libraries?

2012-09-11 Thread Jayden
On Tuesday, September 11, 2012 9:42:56 AM UTC-4, Marco Nawijn wrote:
> On Monday, September 10, 2012 11:10:55 PM UTC+2, Jayden wrote:
> 
> > Are there any python CAD libraries that can
> 
> > 
> 
> > 
> 
> > 
> 
> > (1) build simple 3D primitives solids such as spheres, cylinders and so on
> 
> > 
> 
> > (2) perform bool operations on 3D solids
> 
> > 
> 
> > (3) better if it has some transformations such has scaling, sweeping, and 
> > lofting
> 
> > 
> 
> > 
> 
> > 
> 
> > Please recommend some good ones for me? Thanks a lot!!
> 
> 
> 
> Hi Jayden,
> 
> 
> 
> In my opinion, the best you can get is OpenCascade (OCC) 
> (www.opencascade.org) in combination with the python bindings 
> (www.pythonocc.org). OCC is a hugh C++ CAD library. It not only deals with 
> the simple geometric stuff, but it can be used to build CAD programs similar 
> to SolidEdge or SolidWorks. It does however come with quite a steep learning 
> curve. When using PythonOCC, the learning curve becomes a little less steep. 
> 
> 
> 
> Also note that in my opinion, Blender cannot be considered as a CAD 
> environment. Ofcourse it is very powerful, but I think it is more targeted 
> towards animation and visually pleasing applications, not mechanical 
> engineering.
> 
> 
> 
> Regards,
> 
> 
> 
> Marco

Hi, Marco,

Thank you so much! This is what I exactly want. But I am a little concerned 
about its steep learning curve. Is it really hard to learn pythonOCC? 
Averagely, how long does it take to begin to program some practical code? Do 
you have any good advice for me to learn it? I deeply appreciate your kind 
help!!

Best regards,

Jayden
-- 
http://mail.python.org/mailman/listinfo/python-list


a python license problem?

2012-09-10 Thread Jayden
Python is under GPL compatible. If I develop a python code, convert it to 
executable and distribute the executable as a commercial software. May I need 
to make my source code open?

If python is under GPL, is the answer different? Thanks a lot!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python CAD libraries?

2012-09-10 Thread Jayden
On Monday, September 10, 2012 5:30:08 PM UTC-4, Gary Herron wrote:
> On 09/10/2012 02:10 PM, Jayden wrote:
> 
> > Are there any python CAD libraries that can
> 
> >
> 
> > (1) build simple 3D primitives solids such as spheres, cylinders and so on
> 
> > (2) perform bool operations on 3D solids
> 
> > (3) better if it has some transformations such has scaling, sweeping, and 
> > lofting
> 
> >
> 
> > Please recommend some good ones for me? Thanks a lot!!
> 
> 
> 
> Try PythonCAD:  http://sourceforge.net/projects/pythoncad/
> 
> 
> 
> (Google would have been faster. :-) )
> 
> 
> 
> Gary Herron
> 
> 
> 
> -- 
> 
> Dr. Gary Herron
> 
> Department of Computer Science
> 
> DigiPen Institute of Technology
> 
> (425) 895-4418

Thank you. But this is for 2D.
-- 
http://mail.python.org/mailman/listinfo/python-list


python CAD libraries?

2012-09-10 Thread Jayden
Are there any python CAD libraries that can

(1) build simple 3D primitives solids such as spheres, cylinders and so on
(2) perform bool operations on 3D solids
(3) better if it has some transformations such has scaling, sweeping, and 
lofting

Please recommend some good ones for me? Thanks a lot!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyQT performance?

2012-09-10 Thread jayden . shui
On Monday, September 10, 2012 2:06:59 PM UTC-4, Vincent Vande Vyvre wrote:
> Le 10/09/12 19:24, jayden.s...@gmail.com a écrit :
> 
> > Anybody has the experience of the performance of the program developed by 
> > pyQT? Is it much slower than the one made by QT, such as (20%)?
> 
> >
> 
> For my experience, 20% is really surestimated.
> 
> 
> 
> I'm developping only with PyQt and essentially in the imaging domain
> 
> (viewing, transformation)
> 
> and I've never seen a difference of processing speed with the same
> 
> applications written in C++.
> 
> 
> 
> Qt + Python, a very good association.
> 
> 
> 
> -- 
> 
> Vincent V.V.
> 
> Oqapy  . Qarte
> 
>  . PaQager 

Have you ever used py2exe? After converting the python codes to executable, 
does it save the time of interpreting the script language? Thank a lot!
-- 
http://mail.python.org/mailman/listinfo/python-list