You are not logged in.

#1 2018-12-04 16:44:14

lycos
Member
Registered: 2013-02-01
Posts: 8

Python Treeview widget problem only at arch

I am writing a program with Python using tkinter for GUI and I noticed that the Treeview widget
cannot paint the rows with color. I am using Python 3.7.1 but I don't think its a python bug because
the same version works fine with Linux Mint 19 and Windows. I also tried the Python versions 3.6 and 3.5 from aur
and they also have problem with Treeview.

I am using arch with cinnamon and I tried it also with xfce  (in a virtualbox).

Is there anything to do to fix it?


I wrote a script to check it:

from tkinter import *
from tkinter import ttk

name_list = ('George', 'Maria', 'Peter', 'Nick')
surname_list = ('Lycos', 'Ntou', 'Wolf', 'Stath')
telephone_list = ('6950 123123', '6950 123456', '6951 025458', '6970 985214')
root = Tk()
root.title('Treeview')
root.configure(background='Yellow Green')

ttk.Label(root, text='There must be colors at some rows:', font=('DejaVu Sans', 11, 'bold'), background= 'yellow green').grid(row=0, column=0)
tree = ttk.Treeview(root, columns=('name', 'surname', 'telephone'))
tree.grid(row=1, column=0)
ttk.Button(root, text='Exit', command=root.destroy).grid(row=3, column=0, pady=10)
tree.heading('#0', text='Α/Α')
tree.heading('name', text='Name')
tree.heading('surname', text='Surname')
tree.heading('telephone', text='Telephone')

tree.column('#0', width=50)
tree.column('telephone', anchor='center')

for i, (name, surname, telephone) in enumerate(zip(name_list, surname_list, telephone_list), start=1):
    if i % 2 != 0:
        tree.insert(parent='', index='end', iid=str(i), text=str(i), values=(name, surname, telephone))
    else:
        tree.insert(parent='', index='end', iid=str(i), text=str(i), tags = 'paint', values=(name, surname, telephone))

tree.tag_configure(tagname='paint', background='yellow2')
root.mainloop()

The result in Linux Mint 19:
https://i.imgur.com/ovrp2yf.png

The result in arch:
https://i.imgur.com/tKXs1he.png

Last edited by jasonwryan (2018-12-04 16:57:47)

Offline

#2 2018-12-04 16:55:27

headkase
Member
Registered: 2011-12-06
Posts: 1,830

Re: Python Treeview widget problem only at arch

The problem may be Python, but it's more likely to be tk as that does the rendering.  Also, you have two imports.  One imports the wildcard * and the other imports a specific name.  Since you have the wildcard first doesn't that make the specific name redundant?

Offline

#3 2018-12-04 16:58:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 26,229
Website

Re: Python Treeview widget problem only at arch

Read the Code of Conduct and only post thumbnails http://wiki.archlinux.org/index.php/Cod … s_and_code


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#4 2018-12-04 17:11:49

headkase
Member
Registered: 2011-12-06
Posts: 1,830

Re: Python Treeview widget problem only at arch

Hey, make sure you have the *exact* same environment theme too between Mint and Arch.  If you change your Arch theme do you get different results?

Last edited by headkase (2018-12-04 17:12:37)

Offline

#5 2018-12-04 17:26:35

lycos
Member
Registered: 2013-02-01
Posts: 8

Re: Python Treeview widget problem only at arch

headkase wrote:

The problem may be Python, but it's more likely to be tk as that does the rendering.  Also, you have two imports.  One imports the wildcard * and the other imports a specific name.  Since you have the wildcard first doesn't that make the specific name redundant?

The first line imports the tk widgets and the second import the ttk widgets. Most tutorials imports like this but a better and more clear way to do this is:

import tkinter as tk
from tkinter import ttk 

Offline

#6 2018-12-04 17:29:56

lycos
Member
Registered: 2013-02-01
Posts: 8

Re: Python Treeview widget problem only at arch

headkase wrote:

Hey, make sure you have the *exact* same environment theme too between Mint and Arch.  If you change your Arch theme do you get different results?

To be honest I thought that and I changed some options of my theme. But I don't have the same theme and that's the reason why I tried it also with arch xfce (with a Virtualbox). But it can be a theme problem..

Offline

#7 2018-12-04 17:30:33

lycos
Member
Registered: 2013-02-01
Posts: 8

Re: Python Treeview widget problem only at arch

jasonwryan wrote:

Read the Code of Conduct and only post thumbnails http://wiki.archlinux.org/index.php/Cod … s_and_code

Sorry (and thanks for  fixing it)

Offline

Board footer

Powered by FluxBB