Working with GVariant in Python



I wrote a Python port[1] of the Bloatpad example application from the GtkApplication docs this weekend as I wanted to play around with those application menus. I ended up submitting a couple of bugs (678655 and 678673) for some of the issues I came across. One of the bugs I can *almost* figure out a fix for, but, those GVariants are throwing me.

Here is how I got it the application to work:

variant = GLib.Variant('s', "left")
action = "" variant.get_type(), variant)


And here is how I think it should work in Python applications:

action = "" "left")


Am I correct in thinking that we shouldn't need a Python application to be working directly with GVariants--that PyGObject should handle that under the hood? If so, could somebody point me in the right direction in learning where and how GVariants are converted to and from Python types?

[1] https://github.com/MicahCarrick/python-bloatpad


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]