Re: Why is there no GUI-tools like this for Windows?
On 2008-07-12 22:35:58 +0100, maestro <[EMAIL PROTECTED]> said: http://www.youtube.com/watch?v=PXpwC1o5AcI I have done some GUI-programming for windows with Python but the Tkinter interface sucked and while it is the only one I tried I got the impression they are all the same. It's amazing how retarded a lot of the stuff programmers do is. Watcing that video, that is how it should be. I can just do the layout with my mouse and then there is a program that writes the code for me. GUI-programming is hard for no reason. One good program then forever easy... Is there not something like this for Python/Windows? Is the Linux one only for ruby or for any language? Oh well im switching to Linux anyway and mostly write webapps but still... PyQt4 is available for Windows and lets you use the Qt Designer application which is pretty good. Works well, you should take a look. -- "I disapprove of what you say, but I'll defend to the death your right to say it." - Voltaire -- http://mail.python.org/mailman/listinfo/python-list
Problems returning data from embedded Python
Okay I'm having a few issues with this and I can't seem to get it sorted out (most likely due to my inexperience with Python). Here is my Python code: def fileInput(): data = [] s = raw_input("Please enter the filename to process (enter full path if not in current directory): ") fd = open(s, "r") fd.readline() line = fd.readlines() for record in line: record = record.strip() items = record.split(',') for i in range(1, 5): items[i] = float(items[i]) items[5] = int(items[5]) data.append(items) fd.close() return items It works perfectly and does exactly what I want it to do. The problem comes when I try and convert the data I returned from the Python script and turn it into something useable in C. I have no idea. The C functions that seem most use deal with Tuples, when this is a list and I can't see any specific functions for dealing with lists in the C API. Can anyone give me some pointers in the right direction at all please? I know the C program has received the data correctly, I just need to put it in C types. Thank you. -- "I disapprove of what you say, but I'll defend to the death your right to say it." - Voltaire -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems returning data from embedded Python
On 2008-08-12 05:37:53 +0100, "Gabriel Genellina" <[EMAIL PROTECTED]> said: En Mon, 11 Aug 2008 12:58:00 -0300, Cromulent <[EMAIL PROTECTED]> escribi�: Uh? You have a complete API for working with list objects, the functions named PyList_* See http://docs.python.org/api/listObjects.html There is also an abstract layer that works both with lists and tuples: http://docs.python.org/api/sequence.html If that's not what you are after, please provide more details... Thank you for the advice. Bah, just noticed that the very last function on that page you linked is what I am looking for. I could use PyList_AsTuple and then use PyArg_ParseTuple to convert it to C types. Why do I always miss the obvious? You have no idea how long I've spent looking through that API reference :). -- "I disapprove of what you say, but I'll defend to the death your right to say it." - Voltaire -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems returning data from embedded Python
On 2008-08-12 05:37:53 +0100, "Gabriel Genellina" <[EMAIL PROTECTED]> said: En Mon, 11 Aug 2008 12:58:00 -0300, Cromulent <[EMAIL PROTECTED]> escribi�: Uh? You have a complete API for working with list objects, the functions named PyList_* See http://docs.python.org/api/listObjects.html There is also an abstract layer that works both with lists and tuples: http://docs.python.org/api/sequence.html If that's not what you are after, please provide more details... Spoke too soon. Right, I've rewritten the Python program and it returns a tuple of lists and one integer. Basically as you saw before, the python program reads a file in, splits it into elements that were separated by a comma. The new program just puts each element into its own list. Here is a line from the file I am reading in: 15-Jul-08,37.70,37.70,36.43,36.88,102600 so basically I have 6 lists and one int (which is the total number of lines read by the program) I then return that tuple to the C program. After that I call the following: error = PyArg_ParseTuple(value, "isi", &totalLines, &finopen, &finclose, &finhigh, &finlow, &finvolume); but that will only give me the first element of the list. What I would like to do is return the total number of lines read separately, then use that to allocate a C99 style variable sized array and then loop through the call to PyArg_ParseTuple to populate the array. The problem with that is that I don't think PyArg_ParseTuple is designed in that way. It will put the contents of the list in the variable and not split it up so that I can populate an array. Am I making any sense? Probably not, but it is hard to explain. Thanks for any help. -- "I disapprove of what you say, but I'll defend to the death your right to say it." - Voltaire -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems returning data from embedded Python
On 2008-08-13 00:50:11 +0100, "Gabriel Genellina" <[EMAIL PROTECTED]> said: En Tue, 12 Aug 2008 19:48:54 -0300, Cromulent <[EMAIL PROTECTED]> escribi�: On 2008-08-12 05:37:53 +0100, "Gabriel Genellina" <[EMAIL PROTECTED]> said: Yes, forget about PyArg_ParseTuple. It's intended to parse function arguments. Use the appropiate convert function for each object type. For integers, use PyInt_AsLong; for floats, PyFloat_AsDouble, and so on. Something like this (untested): // for a column containing float values: Py_ssize_t nitems = PyList_Size(the_python_list_of_floats) // ...allocate the C array... for (Py_ssize_t i=0; i Fantastic! Thanks for your help :). You've got me on the right path now. -- "I disapprove of what you say, but I'll defend to the death your right to say it." - Voltaire -- http://mail.python.org/mailman/listinfo/python-list