Skip to content

Commit 3911794

Browse files
authored
Create ubuntu-tkinter.md
1 parent 906b06b commit 3911794

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

assign2/ubuntu-tkinter.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Tkinter Display Issue
2+
Some users have been running into a display issue on Windows installations running Python through Ubuntu bash. The issue happens because the software in the starter code for `requests` uses Python visualization features but, by default, Ubuntu bash is not configured to recognize that it's connected to a display that supports those features.
3+
4+
In this guide, we'll install software that allows Ubuntu bash to communicate with the Windows operating system and use your computer's built-in display.
5+
6+
## 1. Create a Virtual Display that Mirrors to the Actual Display
7+
We first need to create a way to communicate between Ubuntu bash and the default Windows operating system about the display setup. To create this, install [Xming X Server for Windows](https://sourceforge.net/projects/xming/) and, during the installation, set the display value to 0. This tells the server to host its virtual display mirror on "port" 0.
8+
9+
## 2. Tell Ubuntu Bash to Use the Virtual Display
10+
Once that is set up, we need to tell Ubuntu bash to use the virtual display that we just configured. At a command line run:
11+
12+
```
13+
$ export DISPLAY=:0
14+
```
15+
16+
You'll need to do this every time you open up a terminal prompt, because the export settings get re-set when the terminal closes.
17+
18+
## 3. Configure Permissions on the Display
19+
By default, Ubuntu bash will not allow programs to display things. To change that, we need to change the permissions on the display. Run the following lines of code:
20+
21+
```
22+
$ sudo apt install x11-xserver-utils
23+
$ xhost +
24+
```
25+
26+
After the first command, there will be some installation prompts. After the second, you should see a message that says something like `access control disabled, clients can connect from any host`.
27+
28+
## 4. Run `visualizaton.py`
29+
Now, you should be able to execute:
30+
31+
```
32+
$ python3 visualization.py
33+
```
34+
35+
> With 🦄s by @psarin and @coopermj

0 commit comments

Comments
 (0)