Python/tk differences with Windows and Linux

A forum for general discussion of the Python programming language.

Python/tk differences with Windows and Linux

Postby monsteriname » Tue Jan 28, 2014 9:44 am

I'm hoping to find a collection of info explaining the common differences that may be expected running the same Python with tk apps between Linux and Windows.

Anyone know of a place or document with such a focus?

I ran into a specific problem right out the gate(I won't ask about it- in this thread, wrong sub-forum) but my searches for an answer were fruitless, I suspect its a difference between Windows and Linux.
Last edited by monsteriname on Sun Feb 02, 2014 7:35 am, edited 1 time in total.
monsteriname
 
Posts: 5
Joined: Tue Jan 28, 2014 7:45 am

Re: Python/tk differences with Windows and Linux

Postby Mekire » Tue Jan 28, 2014 9:51 am

I won't say that it is not a difference between windows and Linux, but I think it much more likely that it is a difference between python 2 and python 3.

I have had some major problems getting PIL to work with tkinter on windows, where the same code ran without issue on Linux. This however is technically a PIL issue not a tkinter one (though tkinter should damn well have native support for graphics loading >.>)

-Mek
User avatar
Mekire
 
Posts: 1124
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: Python/tk differences with Windows and Linux

Postby monsteriname » Tue Jan 28, 2014 10:39 am

Good thought Mek,
I went and checked versions after reading but they are the same - 2.7

The problem I ran into was not that the app wouldn't run, but that the colors aren't doing what I want.
From looking at the results it looks as if the two systems might define things a little differently. I of course don't know, I am a beginner. If I don't find info about any standard differences in the behaviour of them I will post my specific problem somewhere.

Thanks
monsteriname
 
Posts: 5
Joined: Tue Jan 28, 2014 7:45 am

Re: Python/tk differences with Windows and Linux

Postby Mekire » Tue Jan 28, 2014 11:06 am

Just post the code here (or a link if it is excessively long).

-Mek
User avatar
Mekire
 
Posts: 1124
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: Python/tk differences with Windows and Linux

Postby monsteriname » Tue Jan 28, 2014 11:32 am

Thanks,
By "just post it here" I hope you meant here here. If not sorry, I will re-post elsewhere.

This is cut down to only one button but still the same problem. It may be a case of it "working by accident" part of the time.

I expect; black background with yellow letters to start - and yellow background with black letters when I hover over it with the mouse.

That is what happens on my Linux boxes.

On the Windows box, the foreground(text) does what I expect, but not the background. The button color- what I am calling the background- starts out grey, then turns light blue when I hover over it with the mouse. If I look really hard I can see a thin yellow outline around the button when I hover over it, so something yellow is happening- but not the same as in the Linux boxes.

Code: Select all
from Tkinter import *
import Tkinter as tk
import ttk

root = Tk()
root.geometry("100x100+10+10")

content = Frame(root)

ttk.Style().configure("TButton", background="black", foreground="yellow", justify=LEFT)

style = ttk.Style()
style.map('colorsiwant.TButton',
        background=[('active', '#ffff00')],
        foreground=[('active', '#000000')]
        )

EmpName11 = ttk.Button(content, text="huh", style="colorsiwant.TButton", width=9)

content.grid(column=0, row=0, sticky="nswe")
EmpName11.grid(column=1, row=1, sticky="nswe")

root.rowconfigure(0, weight=1)
root.columnconfigure(0, weight=1)
content.rowconfigure(1, weight=1)
content.columnconfigure(1, weight=1)

root.mainloop()


Thanks for any help,
monsteriname
 
Posts: 5
Joined: Tue Jan 28, 2014 7:45 am

Re: Python/tk differences with Windows and Linux

Postby monsteriname » Sun Feb 02, 2014 7:33 am

For future searchers

I found a past user(1) with the same(similar) problem;
https://groups.google.com/forum/#!searc ... QIsATDemEJ
That made me dig deeper, and I found this;
https://www.tcl.tk/man/tcl/TkCmd/option ... background
And in that tcl documentation it kind of comfirms there are differences in the way the different operating systems cause/allow the widgets to appear and operate. So I am off to decide how to procede given that info.

Thanks,
monsteriname
 
Posts: 5
Joined: Tue Jan 28, 2014 7:45 am

Re: Python/tk differences with Windows and Linux

Postby Mekire » Sun Feb 02, 2014 7:38 am

Quite often gui toolkits will appear differently on different operating systems with the goal of creating more native looking applications.

I didn't think tkinter actually did this but perhaps it does.
Basically if you want a more native looking application try other toolkits (wxpython, pyQT, pyGTK).

-Mek
User avatar
Mekire
 
Posts: 1124
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: Python/tk differences with Windows and Linux

Postby monsteriname » Sun Feb 02, 2014 8:08 am

Thanks Mek,

Pondering my choice of Tk is one of the things I'll be thinking about. But I have no need for Native look. My app started out very distinctively colored partly because (some of) the interfaces will be very busy - that is very full of buttons etc. I am doing whatever I can for 'speed of use' of the interface. The brilliant color change left no doubt what had focus.

When I moved it to the Windows box, the grey - to - not-quite-fain-tbluish-grayish color change that I'm stuck with does not jump out at you and scream "you are here" like I wanted.

I may also play with the preinstalled theme on windows, change it to a higher contrast. I don't know.

Thanks again,
monsteriname
 
Posts: 5
Joined: Tue Jan 28, 2014 7:45 am


Return to General Discussions

Who is online

Users browsing this forum: Google [Bot] and 2 guests