Re: Extending Python Questions .....
Ben bnsili...@gmail.com wrote: On Feb 24, 11:31?am, Nick Craig-Wood n...@craig-wood.com wrote: So do you want to embed python into your code? I'm still not clear what you are trying to achieve with python, though I have a better idea what SLAG is now! Actually no, I want to EXTEND python using the lower levels of S-lang screen modules. Ah! My Modules are written in C and are a frame work for building pull- down menus and data entry screens. Very nice for writing business applications. Think along the lines of FoxPro and/or the Screen section in Cobol and you have a pretty good idea of what i have done. You've got several choices. 1) Write a python module in C which interfaces with your C code. This is the traditional way, but it is quite time consuming and easy to slip up with reference counting. You need to learn the python API to use this. Will require compiling by your users (not a big hurdle if you make a setup.py). 2) Write an interface with ctypes If your C code presents itself as a shared object (dll/so) then this is a really nice way of using it. You don't have to write any C code or worry about any reference counting - you do it all in python. You'll need to learn how ctypes maps python onto C, but as you know C well you won't find this difficult. ctypes is included with python now. 3) Use Cython Cython is a sort of hybrid C and python which can be used for interfacing with C code. This requires learning exactly what you can and can't do in Cython (it is almost python but not quite). This will require your users to install Cython and compile stuff. Again easy if you make a setup.py but more stuff to install. 4) Use Swig A solid approach, quicker than 1) but not as quick as 2) or 3) This will require your users to install swig and a compiler. ... My prefered approach is 2) ctypes at the moment. I have used all 4 of the above approaches in the past though! -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending Python Questions .....
On Feb 24, 11:31 am, Nick Craig-Wood n...@craig-wood.com wrote: Ben bnsili...@gmail.com wrote: No, It uses the the S-lang for video, and input control. However, SLAG is more of an abstract layer on top of that. It has a Structures that contains menus and screens (menumodule / screenmodule). One LOADS them up with parameters. such as creating a new menu is like: OpenMenu( Company name, SubSystem, this program name, mode, bottom status display) - Create initial menu structure Addtomenu(Menu Block Set name, DISPLAY line, ID, type of program, password ID ) - add to / update MENU blocks. runMenu() - Displays the whole create menu structure. The Menu structure is done in pull downs and scrollable blocks in a TUI (text User Interface) and using the S-lang screen library is fully mouseable. The screen module works mych the same way, but with the abiltity to open and close and work within Sub Screens. For those who do not know, S-lang is a interpreted language much like Python. However, there is s direth of library modules. The original S-lang started out as library of screen of keyboard modules, but has been expanded My SLAG project does not care in reality WHICH or what language, it is simply handling menu and screen control. So do you want to embed python into your code? I'm still not clear what you are trying to achieve with python, though I have a better idea what SLAG is now! -- Nick Craig-Wood n...@craig-wood.com --http://www.craig-wood.com/nick Actually no, I want to EXTEND python using the lower levels of S-lang screen modules. My Modules are written in C and are a frame work for building pull- down menus and data entry screens. Very nice for writing business applications. Think along the lines of FoxPro and/or the Screen section in Cobol and you have a pretty good idea of what i have done. -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending Python Questions .....
On Feb 23, 2:31 pm, Nick Craig-Wood n...@craig-wood.com wrote: Ben bnsili...@gmail.com wrote: In My S-Lag Project called, SLAG, I have some function keys that get mapped back to S-lang internal functions. My SLAG project works pretty much like Python (as does the S-Lang). You write a S-lang script that imports your extension. module - and all this gets run by the shell/interpreter. I allow function keys to be mapped back internal function(s) inside of the controlling program. My question is which Python C api Do I need to this with ? Do you mean like this? http://code.google.com/p/python-slang Not sure how well maintained it is though. Do I need to worry about my reference counting since the Python Program is in essence calling a function in itself? I'm not sure I understand you here, but in general you don't need to worry about reference counting in Python - it all happens behind the scenes. If you are writing a python extension in C then you do need to worry about reference counting - a lot! -- Nick Craig-Wood n...@craig-wood.com --http://www.craig-wood.com/nick No, It uses the the S-lang for video, and input control. However, SLAG is more of an abstract layer on top of that. It has a Structures that contains menus and screens (menumodule / screenmodule). One LOADS them up with parameters. such as creating a new menu is like: OpenMenu( Company name, SubSystem, this program name, mode, bottom status display) - Create initial menu structure Addtomenu(Menu Block Set name, DISPLAY line, ID, type of program, password ID ) - add to / update MENU blocks. runMenu() - Displays the whole create menu structure. The Menu structure is done in pull downs and scrollable blocks in a TUI (text User Interface) and using the S-lang screen library is fully mouseable. The screen module works mych the same way, but with the abiltity to open and close and work within Sub Screens. For those who do not know, S-lang is a interpreted language much like Python. However, there is s direth of library modules. The original S-lang started out as library of screen of keyboard modules, but has been expanded My SLAG project does not care in reality WHICH or what language, it is simply handling menu and screen control. Hope this helps ... -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending Python Questions .....
Ben bnsili...@gmail.com wrote: No, It uses the the S-lang for video, and input control. However, SLAG is more of an abstract layer on top of that. It has a Structures that contains menus and screens (menumodule / screenmodule). One LOADS them up with parameters. such as creating a new menu is like: OpenMenu( Company name, SubSystem, this program name, mode, bottom status display) - Create initial menu structure Addtomenu(Menu Block Set name, DISPLAY line, ID, type of program, password ID ) - add to / update MENU blocks. runMenu() - Displays the whole create menu structure. The Menu structure is done in pull downs and scrollable blocks in a TUI (text User Interface) and using the S-lang screen library is fully mouseable. The screen module works mych the same way, but with the abiltity to open and close and work within Sub Screens. For those who do not know, S-lang is a interpreted language much like Python. However, there is s direth of library modules. The original S-lang started out as library of screen of keyboard modules, but has been expanded My SLAG project does not care in reality WHICH or what language, it is simply handling menu and screen control. So do you want to embed python into your code? I'm still not clear what you are trying to achieve with python, though I have a better idea what SLAG is now! -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending Python Questions .....
On Feb 24, 11:31 am, Nick Craig-Wood n...@craig-wood.com wrote: Ben bnsili...@gmail.com wrote: No, It uses the the S-lang for video, and input control. However, SLAG is more of an abstract layer on top of that. It has a Structures that contains menus and screens (menumodule / screenmodule). One LOADS them up with parameters. such as creating a new menu is like: OpenMenu( Company name, SubSystem, this program name, mode, bottom status display) - Create initial menu structure Addtomenu(Menu Block Set name, DISPLAY line, ID, type of program, password ID ) - add to / update MENU blocks. runMenu() - Displays the whole create menu structure. The Menu structure is done in pull downs and scrollable blocks in a TUI (text User Interface) and using the S-lang screen library is fully mouseable. The screen module works mych the same way, but with the abiltity to open and close and work within Sub Screens. For those who do not know, S-lang is a interpreted language much like Python. However, there is s direth of library modules. The original S-lang started out as library of screen of keyboard modules, but has been expanded My SLAG project does not care in reality WHICH or what language, it is simply handling menu and screen control. So do you want to embed python into your code? I'm still not clear what you are trying to achieve with python, though I have a better idea what SLAG is now! -- Nick Craig-Wood n...@craig-wood.com --http://www.craig-wood.com/nick Maybe he wants SendKeys? Here's the link just in case: http://pypi.python.org/pypi/SendKeys/0.3 Mike -- http://mail.python.org/mailman/listinfo/python-list
Extending Python Questions .....
Ok... Now I can start asking. In My S-Lag Project called, SLAG, I have some function keys that get mapped back to S-lang internal functions. My SLAG project works pretty much like Python (as does the S-Lang). You write a S-lang script that imports your extension. module - and all this gets run by the shell/interpreter. I allow function keys to be mapped back internal function(s) inside of the controlling program. My question is which Python C api Do I need to this with ? Do I need to worry about my reference counting since the Python Program is in essence calling a function in itself? Thanks Ben ... -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending Python Questions .....
Ben schrieb: Ok... Now I can start asking. In My S-Lag Project called, SLAG, I have some function keys that get mapped back to S-lang internal functions. My SLAG project works pretty much like Python (as does the S-Lang). You write a S-lang script that imports your extension. module - and all this gets run by the shell/interpreter. I allow function keys to be mapped back internal function(s) inside of the controlling program. My question is which Python C api Do I need to this with ? Do I need to worry about my reference counting since the Python Program is in essence calling a function in itself? What's S-Lag? What is S-Lang? I'm sure I can google that, however I think you might want to provide a bit more context yourself to receive better answers. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending Python Questions .....
Ben bnsili...@gmail.com wrote: In My S-Lag Project called, SLAG, I have some function keys that get mapped back to S-lang internal functions. My SLAG project works pretty much like Python (as does the S-Lang). You write a S-lang script that imports your extension. module - and all this gets run by the shell/interpreter. I allow function keys to be mapped back internal function(s) inside of the controlling program. My question is which Python C api Do I need to this with ? Do you mean like this? http://code.google.com/p/python-slang Not sure how well maintained it is though. Do I need to worry about my reference counting since the Python Program is in essence calling a function in itself? I'm not sure I understand you here, but in general you don't need to worry about reference counting in Python - it all happens behind the scenes. If you are writing a python extension in C then you do need to worry about reference counting - a lot! -- Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list