我想在 Linux 机器上编写一个简单的 GUI 应用程序(几个按钮和一个消息显示区域),与 C 后端一起使用。 C后端代码已经存在,我不想对其进行太多更改。
前端的最佳选择是什么?
最初我以为我会使用 Ruby(例如使用 Shoes 或 Ruby on Rails),但我想知道我是否会花费太多时间来让我的前端与我的 C 后端正确对话。
GTK+ 会是更好的选择吗? 您还有什么建议吗?
无论我做什么,我都必须花费大量时间来制作前端。
最佳答案
我建议使用 python,或者 wxPython或PyQT/PySide 。
为了与C后端通信,可以使用 ctypes
.
以下是文档中 C 函数如何与 ctypes
一起使用的示例。
>>> printf = libc.printf
>>> printf("Hello, %s\n", "World!")
Hello, World!
>>> printf("Hello, %S\n", u"World!")
Hello, World!
>>> printf("%d bottles of beer\n", 42)
42 bottles of beer
>>> printf("%f bottles of beer\n", 42.5)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ArgumentError: argument 2: exceptions.TypeError: Don't know how to convert parameter 2
>>>
关于c - 带 C 后端的简单 GUI 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7222579/