-1

Output Tried same code in 3.7 and the label can be displayed but not in python 3.9

I tried run same code in 3.7 and the label can be displayed.

Version of pyglet is 1.5.16.

Tried to add "win.flip()" but still no luck.

import pyglet
import pyglet.text
window = pyglet.window.Window(500,500, "Testing!!!")
label = pyglet.text.Label("Hello,wold!!!",x=10,y=10)
label.color = (100, 255, 100, 255)

@window.event
def on_draw():   
    window.clear()
    label.draw()
    window.flip()
pyglet.app.run()
Daniel Wu
  • 31
  • 5
  • Can you show the code? (a minimum reproducable example) and say exactly what you mean by "doesn't work" (full traceback, or description if there is no error) – mousetail May 07 '21 at 08:18
  • Posted code. No error showed. Just got blank Window. The title can be displayed. – Daniel Wu May 07 '21 at 08:29
  • If you remove `window.flip()` it works fine for me. The text appears in the bottom left corner – mousetail May 07 '21 at 08:36
  • What is your python version?I tried in 3.7 and the text can be displayed too but not in 3.9.Actually I didn't put window.flip() in my first try. I just tried to remove it but still same. I just follow https://stackoverflow.com/questions/37354309/pyglet-hello-world-example-doesnt-show-label-until-a-key-is-pressed – Daniel Wu May 07 '21 at 08:38
  • I'm running python 3.9.4 and pyglet 1.5.16. Can you post a screenshot of what your window looks like if you remove `window.flip()` – mousetail May 07 '21 at 08:40
  • Posted Output.,,,, – Daniel Wu May 07 '21 at 08:44
  • In my case also removing the window.flip() results in the label being drawn – typedecker May 07 '21 at 08:51

1 Answers1

0

I fixed the problem. I tried to run same code in another computer with same version of Python (3.9.5) and Pyglet (1.5.16) and the label text can be displayed, so I pretty sure that the problem does not relate to both items.

Thanks for below link to give me hint that the issue maybe relate to hardware setting. Blank screen when running pyglet from wine

I am running the problematic code on VM in ESXi, after enable 3D support. The text can be displayed.

Daniel Wu
  • 31
  • 5