Vityou
Vityou

Reputation: 135

Python tkinter wont display diagonal lines

I recently started using Arch Linux, and after transferring a python file from my mac to the Linux, and running it, it did not work. This is pretty common, but, the way in which it didn't work was very strange. The program is one that graphs equations of lines, but on Linux, the tkinter Canvas object's create_line method no longer displays diagonal lines. For example, graphing y=x wouldn't show anything but it would say it successfully graphed the line. I tried drawing a diagonal line (from (0, 0) to (20, 20)) outside of my program, and it doesn't work there either. I tried adjusting the width, which didn't change anything. I'm using i3wm, and tried lxde, which didn't change anything. I have the latest version of python3 installed with pacman, and I had to install tk separately. Is there any way to fix this?

Update: It doesn't work with python3 installed from the website either

Update: Works in a virtual machine running arch linux, so it may have something to do with the drivers or hardware

Edit: here is an example

from tkinter import *
root = Tk()
canvas = Canvas(master=root)
canvas.pack()
canvas.create_line(0, 0, 20, 20)

returns 1, doesn't do anything else. Meanwhile:

canvas.create_line(0, 20, 20, 20) # horizontal line

returns 1, 2, 3... (depends on how many things you have drawn) and draws the line.

Upvotes: 0

Views: 341

Answers (1)

Vityou
Vityou

Reputation: 135

I was able to fix it by installing the correct driver, in my case xf86-video-intel, and rebooting. I think it was just a newbie mistake, but its still sort of interesting that the missing driver only affected diagonal lines in tkinter.

Upvotes: 1

Related Questions