Questions tagged [pyobject]

This is a type which contains the information Python needs to treat a pointer to an object as an object.

Definition

All object types are extensions of this type. This is a type which contains the information Python needs to treat a pointer to an object as an object. In a normal “release” build, it contains only the object’s reference count and a pointer to the corresponding type object. It corresponds to the fields defined by the expansion of the PyObject_HEAD macro.

Documentation

Common Object Structures

70 questions
3
votes
1 answer

How to port Python program from gtk2 to gtk3?

We are trying to port this program from gtk2 to gtk3. When I try pygi-convert.sh I got the following error: Traceback (most recent call last): File "scripts/amir", line 53, in from gi.repository import GObject File…
Daniyal
  • 41
  • 2
3
votes
1 answer

Is it possible to get the PyObject reference from the name of an existing variable?

Is there a way to get object reference of an existing object, in an embedded Python code? In other words: If an object called 'obj' already exist (created by a script), and I need to "convert" it to a PyObject* reference, is there a function like:…
FedFranz
  • 529
  • 1
  • 5
  • 15
3
votes
1 answer

Python 3.4 / GTK / Async

I use tkinter with a async funktion. Now I will use gtk3 in stead of tkinkter. Is there also a way to run my async function? How should I adapt the code Here are some code fragments: async def _event_loop(app, interval=0.05): try: while…
Mika
  • 61
  • 4
3
votes
1 answer

Python,Gtk3: How to make the Progress bar pulsing while other stuffs are running

Based on Classes, i have window which contain a button and progressbar, whenever the button is clicked there two things should happen : 1 - should entried value from dialog pass to class ABCD 2 - While our class ABCD() do his stuff, should our…
3
votes
1 answer

Practical use of PyVarObject, the variable-length subtype of cpython’s PyObject

As someone who has been putting the Python C-API through its paces of late, I am curious about PyVarObject, which the documentation says is a subtype of PyObject used specifically for the definition of variable-length types – and though the caveat…
fish2000
  • 4,289
  • 2
  • 37
  • 76
3
votes
1 answer

Converting PyObject* to C++ Object

I have a shared library (util.so) that returns the following to python: cv::Mat toCvMat(PyObject *ndArrayObj) { // return cv::Mat } I invoke the method from my python script using: Python: testMat = util.toCvMat(orig_frame_gray_img) When I…
ssk
  • 9,045
  • 26
  • 96
  • 169
3
votes
1 answer

python Gtk.PrintOperation print a pdf

Until now i was using a variant of this code to print a pdf that i create with pisa. That is taken from pygtk faq: import gtk import gtkunixprint def print_cb(printjob, data, errormsg): if errormsg: print('Error occurred while…
2
votes
0 answers

How to create transparent image overlay with GStreamer?

I try to overlay a cross-hair with transparent background on top a playbin video, but could not get the video to display. I found a few similar questions but the answers do not work (probably something has changed since they were posted. I tried…
Chu Bun
  • 513
  • 1
  • 5
  • 17
2
votes
1 answer

Is there a way to perform a deep copy of a PyObject without using the Python API (e.g. via C, Rust, etc)?

I was wondering if anyone knew of an implementation/library I could use to perform a deep copy of a PyObject without using the Python API. I'd prefer something in C (as I currently use, and am somewhat familiar with CFFI), but anything (no matter…
BL12345
  • 39
  • 3
2
votes
1 answer

Modify a Python object's attribute when using PyCall.jl in Julia

I'm trying to interface with a python library via PyCall.jl where the library returns a python object (PyObject in Julia) with attributes I want to modify in Julia. For example say I have the following dummy python class, import numpy as np class…
S_B
  • 159
  • 1
  • 6
2
votes
1 answer

Converting PyObject in Python to 2D array in Android using Chaquopy

I'm using Chaquopy in my android project. I have a function in my python class which it returns a 2D array as a PyObject type. Now, I want to convert it to 2D array in my java class. How can I achieve this? EDIT : Here is my Python code : import…
hdiz
  • 1,141
  • 2
  • 13
  • 27
2
votes
1 answer

Create an instance of Python New Style class to embed in C++

I am working with PyObject to embed part of the python code inside C++. I found the solution that works well with python 2.7 using PyInstance_New to create python instance. But it doesn't work with new style python classes which look like this. …
pseudo
  • 385
  • 2
  • 19
2
votes
1 answer

Create Python Constructor with parameter from C++, PyObject

I have a python class A like this. class A: def __init__(self, name): self.name = name def print_lastname(self, lastname): print(lastname) I have to call this code like this. import B a =…
pseudo
  • 385
  • 2
  • 19
2
votes
1 answer

Python 3.5.1, the global variable is not destroyed when delete the module

I have a app loading python35.dll. Use python API PyImport_AddModule to run a py file. And use PyDict_DelItemString to delete the module. There is a global vailable in the py file. The global variable is not destroyed when calling…
ldlchina
  • 927
  • 2
  • 12
  • 31
2
votes
1 answer

accessing python object pointer data

I have a python set that contains a collection of non-hashable python objects with uniform type which I want to process. To improve efficiency of my algorithms, I would like to interface using ctypes with an external index implementation that…
ARF
  • 7,420
  • 8
  • 45
  • 72