-
Notifications
You must be signed in to change notification settings - Fork 26
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
Trying to make a simple window creation program, but it fails #112
Comments
What's the TypeError? If you use a list instead of a tuple does it work?
…On Sun, Sep 27, 2020, at 7:16 AM, Jarno Suni wrote:
I am trying to translate a sample code using python-xcb to respective
code using python3-xcffib:
http://rosettacode.org/wiki/Window_creation/X11#XCB_2
I am using python 3.8.2 in Ubuntu 20.04.
`#!/usr/bin/python3
import xcffib
from xcffib.xproto import *
import xcffib.render
def main():
conn = xcffib.connect()
conn.render = conn(xcffib.render.key)
setup = conn.get_setup()
root = setup.roots[0].root
depth = setup.roots[0].root_depth
visual = setup.roots[0].root_visual
white = setup.roots[0].white_pixel
window = conn.generate_id()
conn.core.CreateWindow(depth, window, root,
0, 0, 640, 480, 0,
WindowClass.InputOutput,
visual,
CW.BackPixel | CW.EventMask,
[ white, EventMask.Exposure |
EventMask.KeyPress ])
conn.core.MapWindow(window)
conn.flush()
while True:
print("pre")
event = conn.wait_for_event()
print("post")
if isinstance(event, ExposeEvent):
color = (0, 0, 65535, 65535)
#rectangle = (20, 20, 40, 40)
rectangle = [xcffib.xproto.RECTANGLE.synthetic(20, 20, 40, 40)]
conn.render.FillRectangles(xcffib.render.PictOp.Src, window,
color, 1, rectangle)
conn.flush()
elif isinstance(event, KeyPressEvent):
break
conn.disconnect()
main()
`
If I use simple assignment to rectangle, it prints TypeError and "pre"
only once. If I use the other way, the outcome is:
> pre
> post
> pre
> Traceback (most recent call last):
> File "./create-xcffib.py", line 44, in
> main()
> File "./create-xcffib.py", line 30, in main
> event = conn.wait_for_event()
> File "/usr/lib/python3/dist-packages/xcffib/*init*.py", line 570, in wrapper
> return f(*args)
> File "/usr/lib/python3/dist-packages/xcffib/*init*.py", line 604, in wait_for_event
> return self.hoist_event(e)
> File "/usr/lib/python3/dist-packages/xcffib/*init*.py", line 684, in hoist_event
> return self._process_error(ffi.cast("xcb_generic_error_t *", e))
> File "/usr/lib/python3/dist-packages/xcffib/*init*.py", line 647, in _process_error
> raise error(buf)
> xcffib.render.PictureError
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#112>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF7VVY4VXJU2MSF5NVEIBLSH43K5ANCNFSM4R3RU6QA>.
|
Well, if I use list
|
So I xtraced it and I get:
That basically looks like the request I expect to send, so I don't think there's an encoding error there. Given that the code in your link doesn't look like it was ever tested, is it possible there's just an API issue here? I don't really know anything about the render extension. |
Aren’t you required to do a |
Yes, I think you're right that users are required to QueryVersion. |
I think the |
I am trying to translate a sample code using python-xcb to respective code using python3-xcffib (0.8.1):
http://rosettacode.org/wiki/Window_creation/X11#XCB_2
I am using python 3.8.2 in Ubuntu 20.04.
If I use simple assignment to rectangle, it prints TypeError and "pre" only once. If I use the other way, the outcome is:
The text was updated successfully, but these errors were encountered: