- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在学习 Python 和 Gtk 3,使用 GObject 自省(introspection)。我已经做了一些样本,并且开始了解它是如何工作的。但是有一件事我不明白,我如何传递 gpointer 参数?
我尝试使用接收缓冲区的函数(使用 gpointer),但我总是以这条消息结束:
无法将属性“pixels”的值从 LP_c_ubyte 转换为 gpointer
(LP_c_ubyte 是我最后一次尝试,但我已经证明了很多类型)
最佳答案
您不能在 GObject 自省(introspection)中传递指针。如果内省(introspection)函数是你自己写的,那么你应该 annotate您的参数文档,例如 (array length=buflen)
,其中 buflen
是给出缓冲区长度的参数的名称。有关详细信息,请参阅链接页面。
如果该函数位于不是您自己编写的库中,请在 API 中四处寻找更适合内省(introspection)的函数,或者向该库提交错误。使用裸 gpointer
的 API 甚至不应该暴露给 Python。
关于python - 将 gpointer 与 Python 和 GObject 自省(introspection)一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19464562/
我遇到以下问题。当我在 g_signal_connect 中以 gpointer 的形式传递定义为 char id_rest[25]; 的 char 参数时> 以这种方式运行: g_signal_
我正在尝试通过编写一些函数来帮助我使用 Gtk 来让自己的生活更轻松(而且我很害怕做一顿饭)。感觉就像我很接近,但没有雪茄。 我已经定义了几个结构: typedef struct action_par
您好,这个问题与 GLib、gpointer 相关。 我创建了一个 gpointer 类型的值。 gpointer keys; 我调用了一个函数 insert_data(gpoi
我正在尝试学习在 C 中使用 void 指针。这是我使用 GLib 编写的代码: #include #include int main (void) { GList *l = NULL;
我试图找到一个类似的问题,但找不到任何解决方案。 我有一个使用 GTK3 用 C 语言编写的软件,我正在尝试为在我的 GUI 上按下按钮设置一个回调。该代码应该传递一个整数作为参数,让我的回调函数知道
// gcc 1.c -o 0 $(pkg-config --cflags --libs gtk+-2.0) #include #include struct tst { GtkWidge
C代码 #include //... GHashTable *hash = g_hash_table_new(NULL, NULL); GString val; g_hash_table_inser
我正在学习 Python 和 Gtk 3,使用 GObject 自省(introspection)。我已经做了一些样本,并且开始了解它是如何工作的。但是有一件事我不明白,我如何传递 gpointer
我是一名优秀的程序员,十分优秀!