Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to add a ImgFace to a node when rendering in memory (%%return) #302

Open
Rafiot opened this issue Sep 2, 2017 · 1 comment
Open

Comments

@Rafiot
Copy link
Contributor

Rafiot commented Sep 2, 2017

It is currently impossible to add a ImgFace to a node and render the tree, QPixmap will complain with the following warning message:

QPixmap: It is not safe to use pixmaps outside the GUI thread

It is important if you want to display the rendered tree directly in a web page for example.

@Rafiot
Copy link
Contributor Author

Rafiot commented Sep 2, 2017

FYI, I solved it this way:

with tempfile.NamedTemporaryFile(suffix='.PNG') as temp:
    img_map = self.tree.render(temp.name, tree_style=self.tree.tree_style)
    temp.seek(0)
    base64_img = base64.b64encode(temp.read())

Rafiot added a commit to Lookyloo/lookyloo that referenced this issue Sep 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant