image lib supports arbitrary canvas coordinate
Can any image(not for line plot, but for pixel set) lib behaves like a person? that is to say: when we are doing image processing( for exapmle, http://www.freebasic.net/forum/viewtopic.php?f=17&t=20057&p=176300#p176300) , the new image maybe have a bigger canvas size than the original image's, and sometimes, nagative coordinate is needed from the math-side viewpoint, Of cause, we can do which by pre-caculating the proper canvas size, coordinate translation in code, but that is tedious Any lib can support some code like followings? thanks [psedu-code] newImg=Image.new('RGB', (200,300)) #begin with a canvas size=200*300, so the x is between[0, 199], y is between [0, 299] newImg.putpixel((500, 600), 'black') #the lib expands the canvas automatically, so till now the canvas size=501* 601 newImage.save('fin.jpg', border=(top=10, bottom=20, left=30, right=40)) #size of fin.jpg is (501+30+40)*(601+10+20) [/code] -- http://mail.python.org/mailman/listinfo/python-list
what does type(subprocess.Popen)== mean?
why does not type(subprocess.Popen)==? Thanks [quote] Python 3.4.4 |Anaconda 2.3.0 (64-bit)| (default, Feb 16 2016, 09:54:04) [MSC v.1 600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess >>> type(subprocess.Popen) >>> import os >>> type(os.path) [/quote] -- https://mail.python.org/mailman/listinfo/python-list
what is the difference between one-line-operation and 2-line-operation
for a simple code [code] vexList = [1, 2, 3] print('vexList', list(vexList)) vexList=map(lambda e: e+1, vexList) print('vexList', list(vexList)) vexList = list(vexList) print('vexList', list(vexList)) vexList=map(lambda e: e*2,vexList) print('vexList', list(vexList)) [/code] py27 says [quote] ('vexList', [1, 2, 3]) ('vexList', [2, 3, 4]) ('vexList', [2, 3, 4]) ('vexList', [4, 6, 8]) [/quote] but py34 says [quote] vexList [1, 2, 3] vexList [2, 3, 4] vexList [] vexList [] [/quote] if I change the above code in to one line [code] vexList = [1, 2, 3] print('vexList', list(vexList)) vexList=list(map(lambda e: e+1, vexList)) print('vexList', list(vexList)) vexList=map(lambda e: e*2,vexList) print('vexList', list(vexList)) [/code] then py27 and py34 get same verList [quote] ('vexList', [1, 2, 3]) ('vexList', [2, 3, 4]) ('vexList', [4, 6, 8]) [/quote] I found 'filter' function behaves likely I found type(map(lambda e: e, vexList)) is in py2 type(map(lambda e: e, vexList)) is in py3 so, what produces this difference between py2 and py3 in nature? is there more examples? where can I find the text abiut his difference? Thanks -- https://mail.python.org/mailman/listinfo/python-list
release: a function to express the 4 steps of math calculation in markdown format
I wrote a post on https://stackoverflow.com/questions/53833884/failed-to-show-calculation-steps-with-sympy-and-markdown Now I wrote https://github.com/retsyo/expand_expression to answer the post partly I released it for it can help others. Thanks -- https://mail.python.org/mailman/listinfo/python-list
why same ctypes code runs on win7, but not on win10?
The attachment is a very simple code that uses the DLL from https://github.com/ying32/govcl to create a GUI application. The code runs on my python 3.6.10 64 bits with win7 64 bits, but failed on my python 3.6.10 64 bits and python 3.7.5 with win10 64 bits, by saying following message. What is the problem? Thanks. ``` vcl.Application_Initialize(Application) OSError: exception: access violation reading 0x9BCEE490 ``` ```python import ctypes def main(): vcl = ctypes.CDLL('liblcl.dll') Application = vcl.Application_Instance() vcl.Application_Initialize(Application) form = vcl.Application_CreateForm(Application, False); vcl.Application_Run(Application); main() ``` -- https://mail.python.org/mailman/listinfo/python-list
question on callback functions with ctypes
question on callback functions with ctypes I try to use GoVCL( https://github.com/ying32/govcl ) in python via ctypes. GoVCL supplies C header and simple C demo under https://github.com/ying32/govcl/tree/master/Tools/makeCHeader/test Now the simple python code can run on both win7 and win10 according to Eryk Sun's suggestion - thank you Eryk Sun. But I am still puzzled by 2 questions 1. the callback function does not been invoked, so there must be something wrong when I deal with it. However, I can't figure it out. 2. in the original main.c, there is no need to call `vcl.SetEventCallback(doEventCallbackProc)`. But I learn this in a python code that uses cffi to call GoVCL. How can I make the python code as simple as the C code? Thanks The following python code is a simplified version of the C code ```python import sys, os import ctypes # In Python 3.8+, ctypes no longer searches PATH or the # current working directory when loading DLLs. liblcl_path = os.path.join(os.path.split(os.path.realpath(__file__))[0], 'liblcl.dll') vcl = ctypes.CDLL(liblcl_path) def _doEventCallbackProc(f, args, argcount): print(f, args, argcount) if f == ctypes.addressof(onButton1Click): vcl.DShowMessage("Hello world!".encode('utf8')) elif f == ctypes.addressof(onFormKeyDown): fnOnFormKeyDown(f, args, argcount) elif f == ctypes.addressof(onFormKeyDown): fnOnFormKeyDown(f, args, argcount) doEventCallbackProc = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_long)(_doEventCallbackProc) def _onButton1Click(sender): vcl.ShowMessage("Hello world!"); onButton1Click = ctypes.CFUNCTYPE(None, ctypes.c_void_p)(_onButton1Click) print(ctypes.addressof(onButton1Click)) Char = ctypes.c_uint16 TShiftState = ctypes.c_uint32 def _onFormKeyDown(sender, key, shift): print(key, shift); onFormKeyDown = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(Char), TShiftState)(_onFormKeyDown) print(ctypes.addressof(onFormKeyDown)) def _onEditChange(sender): print("%s\n", vcl.Edit_GetText(sender)); onEditChange = ctypes.CFUNCTYPE(None, ctypes.c_void_p)(_onEditChange) print(ctypes.addressof(onEditChange)) def main(): vcl.SetEventCallback(doEventCallbackProc) vcl.Application_Instance.restype = ctypes.c_void_p Application = vcl.Application_Instance() vcl.Application_Initialize.argtypes = ctypes.c_void_p, vcl.Application_Initialize(Application) vcl.Application_CreateForm.argtypes = ctypes.c_void_p, ctypes.c_bool vcl.Application_CreateForm.restype = ctypes.c_void_p form = vcl.Application_CreateForm(Application, False); vcl.Form_SetCaption.argtypes = ctypes.c_void_p, ctypes.c_char_p vcl.Form_SetCaption(form, "LCL Form".encode('utf8')); vcl.Form_SetKeyPreview.argtypes = ctypes.c_void_p, ctypes.c_bool vcl.Form_SetKeyPreview(form, True); vcl.Form_SetOnKeyDown.argtypes = ctypes.c_void_p, ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(Char), TShiftState) vcl.Form_SetOnKeyDown(form, onFormKeyDown); vcl.Button_Create.argtypes = ctypes.c_void_p, vcl.Button_Create.restype = ctypes.c_void_p btn = vcl.Button_Create(form); vcl.Button_SetParent.argtypes = ctypes.c_void_p, ctypes.c_void_p vcl.Button_SetParent(btn, form); vcl.Button_SetOnClick.argtypes = ctypes.c_void_p, ctypes.CFUNCTYPE(None, ctypes.c_void_p) vcl.Button_SetOnClick(btn, onButton1Click); vcl.Button_SetCaption.argtypes = ctypes.c_void_p, ctypes.c_char_p vcl.Button_SetCaption(btn, "button1".encode('utf8')); vcl.Button_SetLeft.argtypes = ctypes.c_void_p, ctypes.c_uint32 vcl.Button_SetLeft(btn, 100); vcl.Button_SetTop.argtypes = ctypes.c_void_p, ctypes.c_uint32 vcl.Button_SetTop(btn, 100); vcl.Edit_Create.argtypes = ctypes.c_void_p, vcl.Edit_Create.restype = ctypes.c_void_p edit = vcl.Edit_Create(form); vcl.Edit_SetParent.argtypes = ctypes.c_void_p, ctypes.c_void_p vcl.Edit_SetParent(edit, form); vcl.Edit_SetOnChange.argtypes = ctypes.c_void_p, ctypes.CFUNCTYPE(None, ctypes.c_void_p) vcl.Edit_SetOnChange(edit, onEditChange); vcl.Application_Run.argtypes = ctypes.c_void_p, vcl.Application_Run(Application); main() ``` the C code ```C #include "liblcl.h" #ifdef _WIN32 char *UTF8Decode(char* str) { int len = MultiByteToWideChar(CP_UTF8, 0, str, -1, 0, 0); wchar_t* wCharBuffer = (wchar_t*)malloc(len * sizeof(wchar_t) + 1); MultiByteToWideChar(CP_UTF8, 0, str, -1, wCharBuffer, len); len = WideCharToMultiByte(CP_ACP, 0, wCharBuffer, -1, 0, 0, 0, NULL); char* aCharBuffer = (char*)malloc(len * sizeof(char) + 1); WideCharToMultiByte(CP_ACP, 0, wCharBuffer, -1, aCharBuffer, len, 0, NULL); free((void*)wCharBuffer); return aCharBuffer; } #endif void onButton1Click(TObject sender) { ShowMessage("Hello world!"); } void onOnDropFiles(TObject sender, void* aFileNames, intptr_t len) { printf("aFileNames: %p, len=%d\n", aFileN
any lib to convert 3200+ pic to animated gif?
I want to make an animated GIF from 3200+ png I searched and found http://code.google.com/p/visvis/source/browse/#hg/vvmovie and I wrote: [code] allPic=glob.glob('*.png') allPic.sort() allPic=[Image.open(i) for i in allPic] writeGif('lala3.gif',allPic, duration=0.5, dither=0) [/code] However I got [quote] allPic=[Image.open(i) for i in allPic] File "e:\prg\py\python-2.7.3\lib\site-packages\PIL\Image.py", line 1952, in open fp = __builtin__.open(fp, "rb") IOError: [Errno 24] Too many open files: 'out0572.png' [/quote] Is there other lib for py? thanks -- https://mail.python.org/mailman/listinfo/python-list
real usable file/directory operation module?
there is shutil module, but I find it limits the user heavily. For example, I want to move 2 directories "a/scene" and "c/scene" to "d", but there is "scene" under d already. Then shutil.move will raise Error, "Destination path '%s' already exists" % real_dst So is there any module, which allow me move/copy like Windows does. for example useableShutil.move('a/scene', 'd', overwite=True) -- https://mail.python.org/mailman/listinfo/python-list
how? Py extension does not depend on py version
I found an extension on this blog http://www.cnblogs.com/DxSoft/archive/2011/04/08/2009132.html or you can download the extension directly from http://files.cnblogs.com/DxSoft/PyFetion.rar I found that I can do "from DxVcl import *" in py 2.5/2.6/2.7. When I try this in py24, a msgbox says "no python25.dll is found". However "Dependency Walker" shows that DxVcl does not has the python??.dll dependency. Is this a dark side of python which is not in official python doc? So, to the end, My question is: how can I write such an extension(i.e. not DLL foe ctypes) in C/C++? Thanks Lee -- https://mail.python.org/mailman/listinfo/python-list
how to split this kind of text into sections
I have a long text, which should be splitted into some sections, where all sections have a pattern like following with different KEY. And the /n/r can not be used to split I don't know whether this can be done easily, for example by using RE module [demo text starts] a line we do not need I am section axax I am section bbb, we can find that the first 2 lines of this section all startswith 'I am section' .(and here goes many other text)... let's continue to let's continue, yeah .(and here goes many other text)... I am using python I am using perl .(and here goes many other text)... [demo text ends] the above text should be splitted as a LIST with 3 items, and I also need to know the KEY for LIST is ['I am section', 'let's continue', 'I am using']: lst=[ '''I am section axax I am section bbb, we can find that the first 2 lines of this section all startswith 'I am section' .(and here goes many other text)...''', '''let's continue to let's continue, yeah .(and here goes many other text)...''', '''I am using python I am using perl .(and here goes many other text)...''' ] I hope I have state myself clear. Regards -- https://mail.python.org/mailman/listinfo/python-list
Re: how to split this kind of text into sections
First of all, thank you all for your answers. I received python mail-list in a daily digest, so it is not easy for me to quote your mail separately. I will try to explain my situation to my best, but English is not my native language, I don't know whether I can make it clear at last. Every SECTION starts with 2 special lines; these 2 lines is special because they have some same characters (the length is not const for different section) at the beginning; these same characters is called the KEY for this section. For every 2 neighbor sections, they have different KEYs. After these 2 special lines, some paragraph is followed. Paragraph does not have any KEYs. So, a section = 2 special lines with KEYs at the beginning + some paragraph without KEYs However there maybe some paragraph before the first section, which I do not need and want to drop it I need a method to split the whole text into SECTIONs and to know all the KEYs I have tried to solve this problem via re module, but failed. Maybe I can make you understand me clearly by showing the regular expression object reobj = re.compile(r"(?P[^\r\n]*?)[^\r\n]*?\r\n(?P=bookname)[^\r\n]*?\r\n.*?", re.DOTALL) which can get the first 2 lines of a section, but fail to get the rest of a section which does not have any KEYs at the begin. The hard part for me is to express "paragraph does not have KEYs". Even I can get the first 2 line, I think regular expression is expensive for my text. That is all. I hope get some more suggestions. Thanks. [demo text starts] a line we do not need I am section axax I am section bbb (and here goes many other text)... let's continue to let's continue, yeah .(and here goes many other text)... I am using python I am using perl .(and here goes many other text)... Programming is hard Programming is easy How do you thing? I do’t know [demo text ends] the above text should be splited to a LIST with 4 items, and I also need to know the KEY for LIST is ['I am section ', 'let's continue', 'I am using ', ' Programming is ']: lst=[ '''a line we do not need I am section axax I am section bbb (and here goes many other text)... ''', '''let's continue to let's continue, yeah .(and here goes many other text)... ''', '''I am using python I am using perl .(and here goes many other text)... ''', '''Programming is hard Programming is easy How do you thing? I do’t know''' ] -- https://mail.python.org/mailman/listinfo/python-list
trap the Newwindow2 event on wxPython with IE ActiveX
Hi, everyone. I work on windows os and want to write a IE based webbrowser. For I find that the only method which can handle most of the HTML standard is to embed IE object, I want to change demo\wxIEHtmlWin.py (from old wxPython) into a kind of multi-tab webbrowser( like greenbrowser, maxthon). Now the question is: how can I deal with the NewWindow2 Event? How can I get the url when a new window is to be created, and display this webpage in my app other than a new IE? That is to say: self.ie = wxPython.iewin.wxIEHtmlWin(self, -1) wxPython.iewin.EVT MSHTML NEWWINDOW2(self, -1, self.OnNewWindow2) def OnNewWindow2(self, evt): #how to program here? The artilce on http://support.microsoft.com/kb/q184876/ describes "How To Use the WebBrowser Control NewWindow2 Event" in VB as Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean) Dim frmWB As Form1 Set frmWB = New Form1 frmWB.WebBrowser1.RegisterAsBrowser = TRUE Set ppDisp = frmWB.WebBrowser1.Object frmWB.Visible = TrueEnd Sub Since except "self", OnNewWindow2 only need one extra parameter other that 2, I donno how to change this code into python one? Because I know almost nothing about VB and ActiveX, can somebody give me a ready-to-run simple demo or demo based demo\wxIEHtmlWin.py? Thanx in adavance. -- http://mail.python.org/mailman/listinfo/python-list
Any easy-to-use email send module?
I find that the existing email moudle is some hard for me to understand, especially the part of how to set the CC, BCC and attach the files. Is there any more easy one like this p-code? import easyemail smtpserver=easyemail.server('something') smtpserver.login('[EMAIL PROTECTED]', pwd) newletter=smtpsever.letter(smtpserver) newletter.sendto=['[EMAIL PROTECTED]', '[EMAIL PROTECTED]'] newletter.sendcc=['[EMAIL PROTECTED]', '[EMAIL PROTECTED]'] newletter.sendbcc=['[EMAIL PROTECTED]', '[EMAIL PROTECTED]'] newletter.body='this is the body\nline 2' newletter.att=['c:/file1.txt', 'd:/program files/app/app.exe'] if (newletter.send()==True): print 'send ok' smtpserver.close() Thanx. -- http://mail.python.org/mailman/listinfo/python-list
some OT: how to solve this kind of problem in our program?
1. first of all, what is the English jargon (Optimize? But I think this is not a very good keyword :( )for this problem? So I can use it to search on the internet 2. is there any free/open lib for this? 3. I know for some questions(case 1, case 2, and sudoku), we can use bundles of "FOR...NEXT" loop to program. however I think it is clumsy and inconvenient, especially when there is many vars 4. I don't know how to deal with case 3 and case 4 case: 1. choose x0~x9 from 1~9, and must use all of 1~9, let x0/(10*x1+x2)+x3/(10*x4+x5)+x6/(10*x7+x8)=1/2 2. choose x0~x15 from 1~16, and must use all of 1~16, let +-+-+-+-+ | x0 | x1 | x2 | x3 | +-+-+-+-+ | x4 | x5 | x6 | x7 | +-+-+-+-+ | x8 | x9 | x10 | x11 | +-+-+-+-+ | x12 | x13 | x14 | x15 | +-+-+-+-+ sum of every column =sum of of every row = x0+x5+x10+x11 =x3+x6+x9+x12 3: calculate the minimum of sin((z*x-0.5)^2 + x*2*y^2-z/10)*exp(-((x-0.5-exp(-y+z))^2 + y^2-z/5+3)) where x in [-1,7], y in [-2,2] 4: calculate the root [x,y,z], let (x-0.3)^y^z+x/y/z-x*y*sin(z)+(x+y-z)^cos(x-1) = 1 (y-0.2)^z^x+y/z/x-y*z*sin(x)+(y+z-x)^cos(y-2) = 2 (z-0.1)^x^y+z/x/y-z*x*sin(y)+(z+x-y)^cos(z-3) = 3 I have written the case 1 in python, it needs 90 seconds on my pc, and the same approach in www.freebasic.net takes less than 1 seconds [code for python] import sets import time try: import psyco psyco.full() except: pass d0, d1=1, 2 st=time.time() result=[] for a0 in range(1,10): for a1 in sets.Set(range(1,10))-sets.Set([a0]): for a2 in sets.Set(range(1,10))-sets.Set([a0,a1]): a1a2=a1*10+a2 if 2*a0< a1a2: for b0 in sets.Set(range(1,10))-sets.Set([a0,a1,a2]): for b1 in sets.Set(range(1,10))-sets.Set([a0,a1,a2,b0]): for b2 in sets.Set(range(1,10))-sets.Set([a0,a1,a2,b0, b1]): b1b2=b1*10+b2 if 2*a0*b1b2 + 2*b0*a1a2 < a1a2*b1b2: for c0 in sets.Set(range(1,10))-sets.Set([a0,a1,a2,b0, b1, b2]): for c1 in sets.Set(range(1,10))-sets.Set([a0,a1,a2,b0, b1, b2, c0]): for c2 in sets.Set(range(1,10))-sets.Set([a0,a1,a2,b0, b1, b2, c0, c1]): c1c2=c1*10+c2 if d1*a0*b1b2*c1c2 + d1*b0*a1a2*c1c2 + d1*c0*a1a2*b1b2 == d0*a1a2*b1b2*c1c2: aresult=[[a0, a1, a2], [b0, b1, b2], [c0, c1, c2]] aresult.sort() if aresult not in result: result.append(aresult) et=time.time() print 'time elapsed: %s s' % (et-st) for [[a0, a1, a2], [b0, b1, b2], [c0, c1, c2]] in result: print ' %0d %0d %0d %0d' % (a0, b0, c0, d0) print '--- + --- + --- = ---' print ' %0d%0d%0d%0d%0d%0d %0d' %(a1, a2, b1, b2, c1,c2, d1) print [/code] -- http://mail.python.org/mailman/listinfo/python-list
any lib to generatre treemap?
I want to visualize my disk space like http://www.werkema.com/img/scrnshot/spacemonger.gif. ie. draw the directory as a big rectangle and its size is proportionable to the file size under this directory, then draw and fill small rectangles into it to behalf the size of every files. Is there a lib/src to do so? Or more generally, any lib to draw a list of list [code] this is a list of list [ [dir1, files1], .. [dirN, filesN], ] [/code] to a treemap? thanx -- http://mail.python.org/mailman/listinfo/python-list
Any free python module acts like "Image Processing Toolbox" in matlab?
as the title says, and thanx. for example, that is the help on cpselect(input, base) starts the Control Point Selection Tool ( www.mathworks.com/access/helpdesk/help/toolbox/images/cpselect.html) -- http://mail.python.org/mailman/listinfo/python-list
why ctypes+dll gives a strange result
you can download the files at http://www.newsmth.net/att.php?s.284.38015.655.zip the dll and exe are created by freebasic import ctypes mydll=ctypes.windll.LoadLibrary("mydll.dll") _TwoTimes=getattr(mydll,'[EMAIL PROTECTED]') _TwoTimes.argtypes=[ctypes.c_double] def TwoTimes(i): return _TwoTimes(i) in fact, twotimes function return double*2, but when I use print TwoTimes(10) in python, I get 2226880 thanx -- http://mail.python.org/mailman/listinfo/python-list
how to get the native DC value in Tkinter/wxPython for drawing?
I am porting www.rmchart.com to python, now the code is almost finished, and I have supplied some examples.py which write to picturefiles directly, but the example to draw the chart on GUI stops me. that is the vb declaration nResult (LONG) = RMC_CreateChartOnDC( ByVal nParentDC (LONG), ByVal nCtrlId (LONG), ByVal nX (LONG), ByVal nY (LONG), ByVal nWidth (LONG), ByVal nHeight (LONG), ) nParentDC (LONG) is Device context, on which the chart shall be painted If I pass DC=ctypes.windll.user32.GetDC(0) to it, the chart is shown on the windows, but I don't know how to get the DC in wxPython. It seems that self.GetHandle() in wxPython does not help. Can anyone help me? thanx -- http://mail.python.org/mailman/listinfo/python-list
ANN: pyRMChart 0.0.1 is released
1. What is it? pyRMChart is an interface to DLL-verison RMChart(http://rmchart.com), which is a free, lightweight and elegant chart creator 2. Dependency? Python + ctypes 3. How to install? a) you should install RMChart and make sure it works. On win2k/me/98, maybe you have to get a copy of gdiplus.dll b) copy directory [pyrmchart] and all contents to a directory that in your python's sys.path, eg, python\Lib\site-packages\ c) put rmchart.dll and gdiplus.dll either a directory in your environment PATH or just directory [pyrmchart] 4. How to use? Just read rmchart.chm and check the demos under pyrmchart\demo\, most of them are the Python peer to the *.rmc file in RMChart. Please note, some of the demos needs csv/dat/rmc file from the full RMChart, so you have to check the path in these demos 5. How to pass a parameter via reference? If it is a string, you just give it Pyhthon string. If it is a simple type and the function does not modify it, currently there is only function RMC_AddDataAxis fits it, you just need to pass number [0,4] (in other word, constant RMC_TEXTCENTER, RMC_TEXTLEFT, RMC_TEXTRIGHT, RMC_TEXTDOWNWARD and RMC_TEXTUPWARD) as nLabelAlignment. If it is a cunstom type and the function does not modify it, for example parameter T in RMC_CreateChartI, which is tRMC_CHART type, please check "demo_exploding pie tru info.py" If it is array of number, for example, nFirstDataValue in RMC_AddBarSeries, you just make a variant list/tuple of number and give its name to nFirstDataValue, please check "demo_simplebar.py". As for the following parameter nDataValuesCount which points out the length of the array, if nDataValuesCount in [0, None], the length of nFirstDataValue will be used if nDataValuesCount < len(nFirstDataValue), nDataValuesCount will be used if nDataValuesCount > len(nFirstDataValue), len(nFirstDataValue) will be used since nDataValuesCount has a default as 0, you need not to pass it For other parameter via reference which will be changed in the function, there are 3 ways to pass it. please check RMC_GetChartSizeFromFile section in "demo_misc&get.py" 6. Buggy There are bugs in [gui demo], but I believe it comes from my poor GUI experience. If you can fix it or supply more complex example, please let me know. If there are other bugs, please let me know too. 7. License Python license and mention license, or to say, this pacakge is free even for commercial use, but you should make it clear in your manual that you used pyrmchart(http://pyrmchart.googlepages.com/) in your application. 8. Contact me My e-mail in Python print 'x\x9c\xcbI-(\xc9\xd7+\xa8,\xc9\xc8\xcfsH\xcfM\xcc\xcc\xd1K\xce\xcf\x05\x00ep\x08\xac'.decode('zip') Webspace for pyrmchart http://pyrmchart.googlepages.com/ 9. Question Is there other free chart tool or python lib that can create nice and modern chart? I mean chart, so matplotlib is not the answer. I said "nice and modern", so I don't think http://home.gna.org/pychart/ and http://graphite.sourceforge.net/ fit. And I don't like JAVA and .NET -- http://mail.python.org/mailman/listinfo/python-list
Pure Python GUI lib?
For the word "Pure", I mean it is not a C/C++/Z++.. extension, so that we can use it under pythons of different version. Is it possible? I don't like to update the module for different python and the module Currently, I am writing the interface to iup(http://www.tecgraf.puc-rio.br/iup) via ctypes, but find 2 too strange things which have let me feel blue for some days, and I don't know whether it can be successful or not. Can anyone give me some lights? Thank you. :) You can download the files at http://pyguiviactypes.googlepages.com/mini_bug.zip I am using python 2.5.1 on win2k with sp4 1. in iup.py, if I delete [code] _IupMap.argtypes= [ PTR_Ihandle,#ih ] [/code] then when I choose the menu "MDI-New", no MDI window come out. Why it behaves like this? 2. for most of the time, I can only choose menu "MDI-New" 3~4 times, then it crashes with this msg: [msg] Traceback (most recent call last): File "\loewis\25\python\Modules\_ctypes\callbacks.c", line 206, in 'calling callback function' File "mdisample_callback.py", line 372, in mdi_new IupShow(dlg) File "H:\my_project\iup4py\mini\iup\iup.py", line 434, in IupShow ih, WindowsError: exception: access violation writing 0x72292AA4 Traceback (most recent call last): File "mdisample_callback.py", line 455, in main() File "mdisample_callback.py", line 447, in main IupMainLoop() File "H:\my_project\iup4py\mini\iup\iup.py", line 247, in IupMainLoop return _IupMainLoop() WindowsError: exception: access violation writing 0x9B73F12E [/msg] sometimes the above happens when I delete some "???.argtypes=???" form iup.py 3. and some time, python crashes with this msg: [msg] Traceback (most recent call last): File "mdisample_callback.py", line 455, in main() File "mdisample_callback.py", line 447, in main IupMainLoop() File "H:\my_project\iup4py\mini\iup\iup.py", line 247, in IupMainLoop return _IupMainLoop() WindowsError: exception: priviledged instruction [/msg] -- http://mail.python.org/mailman/listinfo/python-list
how to make bibus with win32com into a exe file
Hi, everyone. http://bibus-biblio.sourceforge.net/ is a bibliographic and reference management software, which runs on windows/linux thru wxwidget. On windows, it uses win32com to insert reference into winword automatically. I have installed all the modules, and can launch and use bibus in my python successfully. I want to make a exe file for windows for the official one can not fire up on my chinese windows, however for pyinstaller, the exe file quits while saying "no attribute bind" or something else( sorry, it disappears so quickly). for py2exe, many modules can not be found automatically for cx_freeze,it says bibus.exe\win32com\gen_py\dicts.dat can not be found So any hints? thank you. -- http://mail.python.org/mailman/listinfo/python-list
any advanced table module for wxpython?
Just like excel or vb does. A grid always looks like a normal grid, and can acts as a normal gird, where we can input some text. but when we click the right-most part, this grid becomes a choice widget, so we can choose some pre-defined gizmo; or it becomes a file-selector, and there is a button with "..." on it, the selected file name is filled; or it pops up a coluor/font choose dialog. It seems that wxpython supports the choice only. thank you -- http://mail.python.org/mailman/listinfo/python-list
Why python says "unexpected parameter 'mini.py'" for my code?
The following is my pure-python wxwidgets test. It runs and give a frame, but soon python comes up to say "unexpected parameter 'mini.py'" and I have to close it. I cannot find the reason. Can somebody give me a hint to let it work well? Thanks http://pyguiviactypes.googlepages.com/mini.py -- http://mail.python.org/mailman/listinfo/python-list
Re: Why python says "unexpected parameter 'mini.py'" for my code?
you need wx-c.so from wxnet.sourceforge.net on linux My source uses wx-c.dll, because I am in ms win2k On Jan 4, 10:30 pm, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > oyster <[EMAIL PROTECTED]> wrote: > > The following is my pure-python wxwidgets test. > > It is hardly pure python since it depends on wxWindows and ctypes... > > > It runs and give a frame, but soon python comes up to say > > "unexpected parameter > > 'mini.py'" and I have to close it. > > I cannot find the reason. Can somebody give me a hint to let it work > > well? Thanks > > I tried it but it doesn't work at all on linux. > > I suggest you use wxPython and stop re-inventing the wheel! > > -- > Nick Craig-Wood <[EMAIL PROTECTED]> --http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: hkimball's question on ctypes
2008/1/9, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Date: Tue, 8 Jan 2008 17:11:18 -0800 (PST) > Subject: ctypes 1. please make your title more specific > >>> from ctypes import * > >>> cdecl = > cdll.LoadLibrary("c:\projects\python\geinterface.dll") 2. are you sure '\' is ok? cdll.LoadLibrary(r"c:\projects\python\geinterface.dll") or cdll.LoadLibrary("c:/projects/python/geinterface.dll") 3. if possibile, you can upload your dll and post the link in the mail-list 4. there is a ctypes official maillist on http://sourceforge.net/projects/ctypes/. but it seems that it is closed to the users since some of my mail from 2007.12 does not appear here. but maybe you can have a try. -- http://mail.python.org/mailman/listinfo/python-list
jpype with JFreeChart, anyone interested to help?
As you may know, there is no beautiful and free chart(not plot, you can find the examples at http://www.jfree.org/jfreechart, http://www.rmchart.com) module for python than runs on windows/linux/mac osx. On the other hand, there is a living package(http://www.jfree.org/jfreechart) for java, and it is nice. So what about make the interface to JFreeChart via jpype(http://jpype.sourceforge.net), or rewrite JFreeChart in and for Python to kick off JVM? I have tried this, but since I don't know Java, I did not go further. If anyone can help me with the following code, or organzie a py_jfreechart team, or put up a pyFreeChart team, that would be great. Thanks [code] import jpype p=r'e:\Java\j2re1.4.0\bin\client\jvm.dll' jpype.startJVM(p, r'-Djava.class.path=h:\jfreechart-1.0.9\lib\jfreechart-1.0.9.jar' ) pkg=jpype.JPackage("org.jfree.data") print pkg.DefaultKeyedValues print pkg.DefaultKeyedValues.DefaultKeyedValues print pkg.DefaultKeyedValues.DefaultKeyedValues.DefaultKeyedValues jc=jpype.JClass("org.jfree.data.DefaultKeyedValues") [/code] [msg] Traceback (most recent call last): File "H:\jfreechart-1.0.9\lib\b.py", line 11, in jc=jpype.JClass("org.jfree.data.DefaultKeyedValues") File "H:\jfreechart-1.0.9\lib\jpype\_jclass.py", line 54, in JClass raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name) jpype._jexception.ExceptionPyRaisable: java.lang.Exception: Class org.jfree.data.DefaultKeyedValues not found [/msg] -- http://mail.python.org/mailman/listinfo/python-list
Re: jpype with JFreeChart, anyone interested to help?
Thanx However I knew Chaco and matplotlib, and I use matplotlib during my school days. And as I have pointed out, they are for "plot", but not "chart". If you don't know the difference between plot and chart, you can have a look at at http://www.jfree.org/jfreechart, http://www.rmchart.com Yes, it is true we can use plot lib to draw chart, but that is tedious. 2008/1/15, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > From: Peter Wang <[EMAIL PROTECTED]> > To: python-list@python.org > Date: Mon, 14 Jan 2008 07:58:02 -0800 (PST) > Subject: Re: jpype with JFreeChart, anyone interested to help? > On Jan 14, 6:51 am, oyster <[EMAIL PROTECTED]> wrote: > > As you may know, there is no beautiful and free chart(notplot, you > > can find the examples > > athttp://www.jfree.org/jfreechart,http://www.rmchart.com) module for python > > than runs on > > windows/linux/mac osx. > > Actually, may I humbly suggest two: > > Chaco: http://code.enthought.com/chaco/gallery/index.shtml > > matplotlib: http://matplotlib.sourceforge.net/ > > > -Peter > > > -- http://mail.python.org/mailman/listinfo/python-list
ANN: pyharu-2.0.8, the interface to libharu(PDF generate lib)
Pyharu is a pure python interface to haru(Haru Free PDF Library, http://libharu.sourceforge.net/) via ctypes. All of the C API is usable. All the example programs in haru C src has been ported. It (should) run on windows/linux without modification. Pyharu is only 1M, which is small and easy to use than ReportLab. Download and discuss, please go to http://groups.google.com/group/pythoncia -- http://mail.python.org/mailman/listinfo/python-list
problem with 'global'
why the following 2 prg give different results? a.py is ok, but b.py is 'undefiend a' I am using Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 #a.py def run(): if 1==2:# note, it always False global a a=1 run() a #b.py def run(): a=1 run() a -- http://mail.python.org/mailman/listinfo/python-list
can multi-core improve single funciton?
I mean this [code] def fib(n): if n<=1: return 1 return fib(n-1)+fib(n-2) useCore(1) timeit(fib(500)) #this show 20 seconds useCore(2) timeit(fib(500)) #this show 10 seconds [/code] Is it possible? and more, can threads/multi-processors/clusters be used to improve fib? thanx -- http://mail.python.org/mailman/listinfo/python-list
Re: can multi-core improve single funciton?
Hi, guys, my fib(xx) is just an example to show "what is a single function" and "what is the effect I expect to see when enable multi-core". My real purpose is to know "whether multi-core can help to improve the speed of a common function". But I know definitely that the answer is NO. -- http://mail.python.org/mailman/listinfo/python-list
check whether a JPG is completed?
there are some pics(most of them are JPGs) on my disk, but some are not completed, that is to say, if I view it in irfanview, the bottom is displayed as a gray block. so I want to check where they are completed. but how to do that in python? (No, I am not saying "how to tell the fileszie when I download a file from internet") thanx -- http://mail.python.org/mailman/listinfo/python-list
how to start thread by group?
my code is not right, can sb give me a hand? thanx for example, I have 1000 urls to be downloaded, but only 5 thread at one time def threadTask(ulr): download(url) threadsAll=[] for url in all_url: task=threading.Thread(target=threadTask, args=[url]) threadsAll.append(task) for every5task in groupcount(threadsAll,5): for everytask in every5task: everytask.start() for everytask in every5task: everytask.join() for everytask in every5task:#this does not run ok while everytask.isAlive(): pass -- http://mail.python.org/mailman/listinfo/python-list
how to set the time of a directory?
os.utime works only against files. so what to do for a directory? thanx -- http://mail.python.org/mailman/listinfo/python-list
Re: how to set the time of a directory?
so, let alone the 'bad' os.utime, is there any way to set the time of directory in windows within official python release? can ctypes be helpful, and how ? I am using totalcommander, which is programmer in delphi, but can set the time of a directory thanx 2008/10/12, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > From: MRAB <[EMAIL PROTECTED]> > To: python-list@python.org > Date: Sat, 11 Oct 2008 11:29:12 -0700 (PDT) > Subject: Re: how to set the time of a directory? > On Oct 11, 1:18 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > On Oct 11, 1:27 am, "Timothy Grant" <[EMAIL PROTECTED]> wrote:> On Fri, Oct > > 10, 2008 at 10:16 PM, oyster <[EMAIL PROTECTED]> wrote: > > > > os.utime works only against files. so what to do for a directory? > > > > thanx > > > > > Not sure why you'd say that. > > > > I am. He's running Windows. > > > > > > > > > > > > > drwxr-xr-x 2 tjg tjg 68 Oct 10 22:23 test > > > ([EMAIL PROTECTED]) python > > > Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:16) > > > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > > > Type "help", "copyright", "credits" or "license" for more information.>>> > > > import os > > > >>> help(os.utime) > > > > > Help on built-in function utime in module posix: > > > > > utime(...) > > > utime(path, (atime, mtime)) > > > utime(path, None) > > > > > Set the access and modified time of the file to the given values. If > > > the > > > second form is used, set the access and modified times to the current > > > time. > > > > > >>> os.utime('test', None) > > > >>> ^D > > > > > ([EMAIL PROTECTED]) ls -ltr > > > drwxr-xr-x 2 tjg tjg 68 Oct 10 22:24 test > > > > > -- > > > Stand Fast, > > > tjg. [Timothy Grant] > > >>> os.utime('WinDir', None) > > > > Traceback (most recent call last): > > File "(stdin)", line 1, in > > WindowsError: [Error 5] Access is denied: 'WinDir' > > > > > > > > I consider this a bug. (Note that os.utime works for directories under > > cygwin) > > This in issue #214245 (2000-09-16). See also > http://mail.python.org/pipermail/python-bugs-list/2004-November/026124.html. -- http://mail.python.org/mailman/listinfo/python-list
search for a python compiler program whose name is jingle
I don't remember its name very clear, it may be 'jingle' or not this program runs on windows and can compile a python program into exe file without gcc it has no webspace but is announced on the author's blog when I find it some times ago. I can't find the link now. I there anybody else know it and tell me? Thanx in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: pyparsing 1.5.1 released
but the pyparsing.py in pyparsing-1.5.1.tar.gz is marked as 2008-10-02 I think it is good too touch all the files' time up-to-date. -- http://mail.python.org/mailman/listinfo/python-list
Re: a question about Chinese characters in a Python Program
I believe that is the problem with encode/code. you can find more @ http://groups.google.com/group/python-cn -- http://mail.python.org/mailman/listinfo/python-list
Re: Creating single .exe file without py2exe and pyinstaller
you can try jungle ( http://www.suda-chen.biz/?page_id=21 ) also > -- 已转发邮件 -- > From: MRAB <[EMAIL PROTECTED]> > To: python-list@python.org > Date: Mon, 20 Oct 2008 15:47:55 -0700 (PDT) > Subject: Re: Creating single .exe file without py2exe and pyinstaller > On Oct 20, 4:48 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > Tino Wildenhain wrote: > > > Abah Joseph wrote: > > > 2) use a python to C(++) compiler and compile the result to .exe, > > >works pretty well for simple applications: > > >http://shed-skin.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
bind to HTMLayout or ubrowser
http://www.terrainformatica.com/htmlayout/ "uses its own lightweight HTML rendering engine", helps you to create applications with the "Web style" user interface http://ubrowser.com/ "is a library that makes it a little easier to embed the Mozilla Gecko rendering engine into your application" is there any python interface to it/them? thanx -- http://mail.python.org/mailman/listinfo/python-list
lib to auto-click mouse
is there any this kind of lib for python? thanx -- http://mail.python.org/mailman/listinfo/python-list
any complete and actual pysqlite example?
I mean not a code to do seperated functions, but a real project I have read the doc of pysqlite, but since I know little about database, I found it is still very hard for me to cook a real database app from the scratch with the help of codelet in pysqlite doc. here is the simplified details: [TABLE 1] bookName text price num author <-- this is actually linked with the [TABLE 2], for one author maybe write many books, I think it is better to do an external link [/TABLE 1] [TABLE 2] authorName text [/TABLE 2] Then [record for TABLE 1] id bookName price authoridx 1 The Definitive Guide to SQLite 30 1 2 Core Python 40 2 3 Dive Into Python35 3 [/record for TABLE 1] [record for TABLE 2] id authorName 1 Michael Owens 2 Wesley J. Chun 3 Mark Pilgrim [/record for TABLE 2] what I need 1. of cause, create the TABLE, and add real data into it. I don't know how to deal with the author item in [TABLE 1] 2. list the data. A question is, when I list the record in [TABLE 1], can I get something like following? "The Definitive Guide to SQLite", 30.0, "Michael Owens" I mean, the authorName is returned automatically, but not only the authoridx 3. what if I del the 1st record in [TABLE 2] since a record in [TABLE 1] use it? 4.I want to do some group, for example, group the record in [TABLE 1] according to their price, so that [30] Book1Name Book2Name [40] Book3Name [50] Book4Name Book4Name does sqlite support this? or I have to do this in python? thanx -- http://mail.python.org/mailman/listinfo/python-list
free chart lib for Python?
I mean chart, not plot. If you don't know the difference, you can check www.advsofteng.com, which is a commercial program is there such a thing with many kinds of chart, i.e. pie-chart, line-chart, ..? A long time ago, I programmed a rmchart interface, however rmchart is windows only, and www.rmchart.com disappeared now See you -- http://mail.python.org/mailman/listinfo/python-list
html ui + py background? any tut?
I have read for many times that the modern appliaction (not a web one, but desktop on) uses html + js for its UI, and python code is for the background work but I have never found event a simple (yet completed) article on how to develop such a thing from scrach in these advocacy thing. Can anyone point out some simple, can-be-followed tutorial on such thing especially for windows os? thanx -- http://mail.python.org/mailman/listinfo/python-list
any lib to extract pages form pdf and then merge?
I want to extract some pages from vary pdf files, then write them with/witout rotation into one new pdf file. something likes this [py] import gfx doc = gfx.open("pdf", r"Theory.pdf") pdf = gfx.PDF() for pagenr in [1,5,7]: page = doc.getPage(pagenr) if pagenr==1: page.rotate(90) #for some pages pdf.startpage(page.width, page.height) page.render(pdf) pdf.endpage() pdf.save("new pdf.pdf") [/py] I have tried pypdf, but it errs and exits on some of my pdfs(no, the files have no password) can someone suggest on such a lib for python on windows/or a pure C-dll? (I mean pdf page->pdf, not pdf page->pic->pdf) thanx -- http://mail.python.org/mailman/listinfo/python-list
re: Dabo 0.9.2 released
I have to say: please let dabo use english if it does not find any langauge resource! I have 'e:\prg\py\sap-24\python e:\prg\py\pure_pylib\_dabo\tools\remove_dLocalize.py .', but then the scripts says 'I don't know _" -- http://mail.python.org/mailman/listinfo/python-list
do replacement evenly
I have some strings, and I want to write them into a text files, one string one line but there is a requirement: every line has a max length of a certain number(for example, 10), so I have to replace extra SPACE*3 with SPACE*2, at the same time, I want to make the string looks good, so, for "I am123456line123456three"(to show the SPACE clearly, I type it with a number), the first time, I replace the first SPACE, and get "I am23456line123456three", then I must replace at the second SPACE block, so I get "I am23456line23456three", and so on, if no SPACE*3 is found, I have to aString.replace(SPACE*2, SPACE). I hope I have stated my case clear. Then the question is, is there a nice solution? thanx -- http://mail.python.org/mailman/listinfo/python-list
Re: do replacement evenly
here is what I get [code] import re reSplitObj=re.compile('([ \t]*)|([^ \t]*)') def evenReplace(aStr, length): aStr=aStr.rstrip() tmp=reSplitObj.split(aStr) tmp=[i for i in tmp if i not in ['', None]] lenStr=[[0, len(i)][i.strip()!=''] for i in tmp] lenSpc=[[0, len(i)][i.strip()==''] for i in tmp] while sum(lenStr)+sum(lenSpc)>length: if sum(lenSpc): lenSpc[lenSpc.index(max(lenSpc))]-=1 else: break newSpc=[' '*i for i in lenSpc] _=[] for i in range(len(tmp)): item=tmp[i] if item.strip()!='': _.append(item+newSpc[i]) else: _.append(newSpc[i]) return ''.join(_) if __name__=='__main__': a='hello world' b= evenReplace(a, 5) print 'a="%s", len=%0i' %(a, len(a)) print 'b="%s", len=%0i' %(b, len(b)) print a='helloworld yeaheventeven ' b= evenReplace(a, 27) print 'a="%s", len=%0i' %(a, len(a)) print 'b="%s", len=%0i' %(b, len(b)) print [/code] 2009/6/2 oyster : > I have some strings, and I want to write them into a text files, one > string one line > but there is a requirement: every line has a max length of a certain > number(for example, 10), so I have to replace extra SPACE*3 with > SPACE*2, at the same time, I want to make the string looks good, so, > for "I am123456line123456three"(to show the SPACE clearly, I type it > with a number), the first time, I replace the first SPACE, and get "I > am23456line123456three", then I must replace at the second SPACE > block, so I get "I am23456line23456three", and so on, if no SPACE*3 > is found, I have to aString.replace(SPACE*2, SPACE). > I hope I have stated my case clear. > > Then the question is, is there a nice solution? > > thanx > -- http://mail.python.org/mailman/listinfo/python-list
Any GUI lib wiget is capable of a WYSIWYG editor?
that is an html editor with text and picture, while the picture is linked to the local image file. for wxPython, the richtextcontrol save the image as en embedded object, so it is not my choice is there any other GUI lib and/or sample code to do so? thanks -- http://mail.python.org/mailman/listinfo/python-list
instructions on adding external Tcl/Tk widget into Tkinter?
It is so funny that the official GUI lib for python is Tkinter, but I cannot find an articles which explains indetail how can we use thounsands of Tcl/Tk widget in Tkinter. For example, I have download the dll at http://www.hwaci.com/sw/tkhtml/index.html, renamed it to tkhtml12.dll and put it in H:\python25\bin\tcl\Tkhtml1.2\ then I edited a h:\python25\bin\tcl\Tkhtml1.2\pkgIndex.tcl file: [**pkgIndex.tcl] if {![package vsatisfies [package provide Tcl] 8]} {return} if {[string compare $::tcl_platform(platform) windows]} {return} if {[info exists ::tcl_platform(debug)]} { package ifneeded Tkhtml 1.2.3 [list load [file join $dir Tkhtml12g.dll] Tkhtml] } else { package ifneeded Tkhtml 1.2.3 [list load [file join $dir Tkhtml12.dll] Tkhtml] } [/**pkgIndex.tcl] but http://tix.sourceforge.net/Tixapps/src/Python/TkHtml.py says [*says*] attempt to provide package Tkhtml 1.2.3 failed: package Tkhtml 0.0 provided instead [/*says*] -- http://mail.python.org/mailman/listinfo/python-list
ask for a RE pattern to match TABLE in html
that is, there is no TABLE tag between a TABLE, for example something with out table tag what is the RE pattern? thanks the following is not right [^table]*? -- http://mail.python.org/mailman/listinfo/python-list
how to judge urllib.Request is finished?
currently I am using [code] req=urllib2.Request(url) data='' if '' not in data: fd=urllib2.urlopen(req) data=fd.read() time.sleep(10) time.sleep(10) blahblah [/code] Is there any other ready-to-use function? And what if the internet connection is chocked so that the html page can not be loaded entirely? -- http://mail.python.org/mailman/listinfo/python-list
a module.pth question
My py24 is installed in h:\python24 I installed pyglet(http://pyglet.org/) in H:\pure_pylib\Multimedia\pyglet-1.0\, if I do [code] >>> import sys >>> sys.path.append(r'H:\pure_pylib\Multimedia\pyglet-1.0') >>> import pyglet [/code] it is ok. but if I created h:\pure_pylib\pyglet.pth file, which containts [code] Multimedia\pyglet-1.0 [/code] then [code] >>> import sys >>> sys.path.append(r'h:\pure_pylib') >>> import pyglet Traceback (most recent call last): File "", line 1, in ? ImportError: No module named pyglet >>> [/code] what is wrong with it? and How to fix it? thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: a module.pth question
there are 2 reasons: 1. I use both py24 and py25, I don't like to install 2 copies of pyglet, which is a pure python module and can be used by py24/25 at the same time, thus I am not willing to put a module under site-packages, instead I use a separate directory(h:\pure_pylib in my case) 2. I also carry python on my U-disk, as you know the driver letter assigned to it is not always same. so I can't use full path name > -- 已转发邮件 -- > From: Mike Driscoll <[EMAIL PROTECTED]> > To: python-list@python.org > Date: Mon, 14 Jul 2008 06:12:25 -0700 (PDT) > Subject: Re: a module.pth question > On Jul 14, 6:26 am, oyster <[EMAIL PROTECTED]> wrote: > > My py24 is installed in h:\python24 > > I installed pyglet(http://pyglet.org/) in > > H:\pure_pylib\Multimedia\pyglet-1.0\, if I do > > [code]>>> import sys > > >>> > sys.path.append(r'H:\pure_pylib\Multimedia\pyglet-1.0') > > >>> import pyglet > > > > [/code] > > it is ok. > > > > but if I created h:\pure_pylib\pyglet.pth file, which containts > > [code] > > Multimedia\pyglet-1.0 > > [/code] > > > > then > > [code]>>> import sys > > >>> sys.path.append(r'h:\pure_pylib') > > >>> import pyglet > > > > Traceback (most recent call last): > > File "", line 1, in ? > > ImportError: No module named pyglet > > > > [/code] > > > > what is wrong with it? and How to fix it? thanks in advance > > I looked in my easy_install.pth and it looks like it should be: > > .\Multimedia\pyglet-1.0 > > But I don't really see any reason not to do it the way you were > earlier with the full path name. Besides, you should be able to > install pyglet to your site-packages folder. Or you could use buildout > if you're just testing modules and you don't want to screw up your > namespace. > > Mike -- http://mail.python.org/mailman/listinfo/python-list
Re: CAB files
there is 2 files: text2pdf.py and cab.py but I get a cab, in which there is a file text2pdf.py in it, but cab.py is created as a directory! [your cab.py starts] blahblah if __name__ == "__main__": import os, glob hfci = HFCI("my-first.cab", verbose=1) files = glob.glob(r"*.py") for fnm in files: hfci.AddFile(fnm) hfci.Close() [/your cab.py ends] > From: Thomas Heller <[EMAIL PROTECTED]> > To: python-list@python.org > Date: Fri, 08 Aug 2008 16:29:10 +0200 > Subject: Re: CAB files > Virgil Stokes schrieb: > > I would appreciate python code for creating *.cab files. > > > > --V. Stokes > > Here is some code that I have still laying around. It has never been > used in production and I do not know what you can do with the cab files > it creates, but I have been able to create a cab and open it with winzip. > -- http://mail.python.org/mailman/listinfo/python-list
embed python in ms-word?
In my ms-word documnet, there are some calculation whihc I have to change due to different argumnet. is there any way to embed python code in word, so that I can write the following as a macro or something else, then the result (i.e. 2) is shown in the word documnet? def f(n): if n<2: return 1 else: return f(n-1)+f(n-2) main() return 'fib(3)=%0i' % f(3) if that is impossible, does there exist such word-addons can do that? thanx -- http://mail.python.org/mailman/listinfo/python-list
Re: embed python in ms-word?
in fact, during my work, I often write documnets in ms-word. But the doc has many numbers in it, which need to be calculated and to be modified frequently. Is there a method to write a ms-word add-in, so that 1.I can type in the calculation steps in some program language, please have a look at http://blender.bokee.com/inc/word_add_in1.jpg 2.then the result (here, it is 8) is shown in the doc when I close this window? please have a look at http://blender.bokee.com/inc/word_add_in2.jpg 3.when I double-click the result 8, I can view/edit the code again 4.the code for calculation is stored in DOC file too, I can change it later mathtype equation is a kind of such thing, but only for displaying nice equation I don't think vba is a good answer, the main reason is: the vba code has an incompact link with its result in the documnet -- http://mail.python.org/mailman/listinfo/python-list
any tool can shrink DLL?
For many external lib, python( and www.freebasic.net) use only the DLL version, whcih is very big often if we want to release our program. So, is there such a tool that can scan a DLL then strip the unused function's code out, so yields a small working DLL? for example, in my program I use only 'compress' function in zlib.dll, then 1. I write a list file in which I emurate the function that I used [code func.lst] compress [/code] 2. run the application [code] shrink zlib.dll func.lst [code] the shrink scans zlib.dll, dumps function 'compress' and all function code on which 'compress' rely, and at last writes tiny-zlib.dll BTW, I know why there is DLL. BTW2, forget upx and so on, they lead to obvious speed down in my experiment -- http://mail.python.org/mailman/listinfo/python-list
how to copy and move file with its attribute?
I mean writeonly, hidden, system and so on attributes I use windows, but if possible, is there any method to do so in a crossplatfrom way? thanks -- http://mail.python.org/mailman/listinfo/python-list
how to let shell.SendKeys use unicode on windows in python
I want to use python to do some automatical operation on windows. the following is the code, which try to open a file with unicode characters in its filename in msword but I can't get it work correctly. Can anybody help me? if that is the shortcoming of WScript, is there any other way to do so in python? (I know there is something like autohotkey, but I am not willing to learn a new langauge ) thanks in advance import time import win32com.client shell = win32com.client.Dispatch("WScript.Shell") shell.AppActivate('winword') time.sleep(0.1) shell.SendKeys('%fo')# Alt+F, O time.sleep(0.1) path=r'c:\some unicode in file name.doc' shell.SendKeys(path) # fail on this line, no unicode appeared shell.SendKeys('{ENTER}') -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: WHIFF += Flash chart widget support (Aaron Watters)
nice the only pity is that amcharts is not a money-free product -- http://mail.python.org/mailman/listinfo/python-list
RE replace problem too
in my case, I want to replace all the function name with '', that is sin(1) -> (1) sin(pi*(2+4)) -> (pi*(2+4)) how can I use RE in this situation? thanx -- http://mail.python.org/mailman/listinfo/python-list
lib to do advanced geometry calculation?
My problem is some complex, because some condition is not supplied as a given value please have a look at http://www.lusiya.com/bbs/attachment/thumb/Mon_0906/80_3201_d2fa7bd75d28675.jpg because I have to do futher calculation based on previous steps as http://www.lusiya.com/bbs/attachment/thumb/Mon_0906/80_3201_d342e52235049e0.jpgshows, I want to get a precise value if possible, that is to say, (sqrt(2), 0), but not (1.414.0) [description] (clear condition) A=point(0,1) B=point(1,1) C=point(0,0) D=point(1,0) AC=segment(A, C) BD=segment(B, D) CD=segment(C, D) AB=segment(A, B) I=midpoint(B, D) (vague condition) E=pointOn(AC) F=pointOn(BD) EF=segment(E, F) G=mirror(A, EF) G=pointOn(CD) H=mirror(I, EF) H=pointOn(AB) (solve) E F [/description] Above is the description of my question, but I also hope I can write a problem like that to solve it. The only lib I know is sympy, but it seems that I must write different and long code accroding to different problem So is there any advanced (and lazy of cause) lib to handle my question? thank you -- http://mail.python.org/mailman/listinfo/python-list
is @ operator popular now?
as the title says. has @ been used in projects? -- https://mail.python.org/mailman/listinfo/python-list
Re: is @ operator popular now?
sorry, I mean "PEP 465 - A dedicated infix operator for matrix multiplication" on https://docs.python.org/3/whatsnew/3.5.html#whatsnew-pep-465 2017-07-15 20:05 GMT+08:00 Matt Wheeler : > On Sat, 15 Jul 2017, 12:35 oyster, wrote: >> >> as the title says. has @ been used in projects? > > > Strictly speaking, @ is not an operator. > It delimits a decorator statement (in python statements and operations are > not the same thing). > However, to answer the question you actually asked, yes, all the time. > > For specific examples, see: > pytest's fixtures > contextlib.contextmanager (makes creating context managers mich simpler in > most cases) > @property @classmethod etc. etc. (I sometimes see these used a bit too > freely, when a plain attribute or a function at the module level would be > more appropriate) > > -- > > -- > Matt Wheeler > http://funkyh.at -- https://mail.python.org/mailman/listinfo/python-list