0

I am trying to build a gui on Colab, via Tkinter. The original project is here: https://github.com/julrog/nn_vis I already know that the problem is due to code being executed on Google cloud server, the problem is how can I build a gui, or more precisely can I ever link it to my local laptop to be visualized, use XMing, or something like this? (my OS is Windows

qiqisein
  • 1
  • 1
  • 2

1 Answers1

1

As ivan_pozdeev says, you need to run a framebuffer server (that will emulate a graphical screen) and create a DISPLAY envvar pointing to it.

!apt-get install -y xvfb # Install X Virtual Frame Buffer
import os
os.system('Xvfb :1 -screen 0 1600x1200x16  &')    # create virtual display with size 1600x1200 and 16 bit color. Color can be changed to 24 or 8
os.environ['DISPLAY']=':1.0'    # tell X clients to use our virtual DISPLAY :1.0

However, if you want to interact with the GUI, that's going to be hard, 'cuz Colab doesn't support interactive screens out of the box.

Eimen
  • 21
  • 1
  • 4
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 19 '22 at 14:57
  • did not work for me. i got an errror "maximum recursion depth exceeded in comparison" when i call env.play() – Miguel Tomás Jan 23 '23 at 18:02