-1

Hello

I have been creating a C/SDL game engine. I would like to use python as my scripting language (don't ask why). I have already figured out how to run C functions from python. Whenever I compile the C functions to be used in python I must compile them as a .so, which allows individual functions to be imported into Python script.

Are there standard library functions I could use to display text box? How do I implement it?

PSS
  • 5,561
  • 5
  • 28
  • 30
Evan Clark
  • 159
  • 1
  • 2
  • 9
  • Have you looked at this question? http://stackoverflow.com/questions/3286448/calling-a-python-method-from-c-c-and-extracting-its-return-value – Kristian K. Jun 02 '13 at 03:33
  • That is already functions in my engine you see the C functions that can be run in Python are compiled into a .so not a .exe and you cant execute .so's so i cant figure out how to combine them together so python and get the C functions and all the other code functions where it can. – Evan Clark Jun 02 '13 at 03:37
  • What do you use to get to compiled C functions? types? – PSS Jun 02 '13 at 04:29
  • This doesn't answer your question, but… have you looked at pygame? It's a set of Python bindings for SDL, plus higher-level wrappers that make your life a lot easier. – abarnert Jun 02 '13 at 05:20

1 Answers1

0

Your actual question may not be what you're looking for an answer to, but it's what you asked, so:

Are there standard library functions I could use to display text box?

Not an SDL text box. There are no standard library functions that do anything with SDL at all. There are standard library functions to display text boxes in a Tk GUI, but they won't help you here.

There are two basic ways to go about displaying widgets in a design like yours.

First, you can find an SDL widget library in C. Try searching the SDL library repository for "Interface" libraries. Pick one that looks promising, write Python bindings for it the same way you did for SDL itself, and you're done.

Alternatively, you can write a widget library in pure Python around your lower-level SDL bindings. This will be a lot more work.

However, I think you'll be a lot happier using pygame than what you're currently doing. It's certainly a lot easier for a novice than trying to interact with SDL directly. But, even for someone who really knows what he's doing, pygame offers so much on top of SDL that it's attractive for almost any project you contemplate.

abarnert
  • 354,177
  • 51
  • 601
  • 671