ttk

How to install Python ttk themes

半城伤御伤魂 提交于 2021-02-20 19:06:33
问题 This is my first post on SO, so please feel free to correct me if I'm doing anything wrong! I am making a simple GUI for my Raspberry Pi (that runs Raspbian stretch) on Windows (because I can use PyCharm on there). I am would like to install third party themes from this site and have followed the instructions on the wiki. However, on both Windows and Raspbian, it appears to install properly without any errors, but when I check for ttk by doing this: import tkinter.ttk tkinter.ttk.Style()

Tkinter - Can I change the background color for a TTK Label set in ReadOnly mode? I tried but it didn't work

随声附和 提交于 2021-02-11 12:30:07
问题 In according with the TTK documentation, in my code, I tried to change the background color only for the TTK labes placed in readonly mode, but unfortunately it didn't work. I replicated the issue below: from tkinter import * from tkinter import ttk class MainWindow: def __init__(self): self.parent=Tk() self.parent.geometry("350x250") self.parent.title("Test") self.parent.configure(background="#f0f0f0") style=ttk.Style() # only the "foreground" option works, but the "background" one not. why?

Tkinter - How can I remove the background borders from ttk.Button?

时光怂恿深爱的人放手 提交于 2021-02-11 06:35:35
问题 by default, the buttons from ttk module, have a one pixel border. how can I delete this border? below an example code: from tkinter import * from tkinter import ttk root = Tk() root.geometry("400x300") style=ttk.Style() style.configure("TButton", padding=0, background="#ffffff") # I colored the background border white to see it in the window.. but, I don't want it, I want to delete the border! MyButton = ttk.Button(root, text="I have a white border.. how can I delet it?") MyButton.place(x=16,

tkinter optionmenu first option vanishes

谁说胖子不能爱 提交于 2021-02-10 14:14:31
问题 A ttk optionmenu widget starts out with all of its values in the dropdown. Upon selecting any value, the first value in the list vanishes, never to reappear... Does anyone know why? Is this a feature of the widget's design? Try it with the following: import tkinter.ttk as ttk import tkinter as tk a = tk.Tk() options = ['1', '2', '3'] value = tk.StringVar() masterframe = ttk.Frame() masterframe.pack() dropdown = ttk.OptionMenu(masterframe, value, *options) dropdown.pack() a.mainloop() Note -

Configure tkinter/ttk widgets with transparent backgrounds, ttk frame background colors?

∥☆過路亽.° 提交于 2021-02-07 12:25:46
问题 Is it possible to configure tkinter or ttk widgets ( Label , Entry , Text ) with a transparent background so that they can be placed in containers with custom background colors or on top of canvas graphics or images? I'm also looking for a way to change the background color of a ttk Frame widget? Do I need to use the new ttk Style objects to accomplish the above? (I'm new to tkinter/ttk and still trying to get my head around the proper way to do things). 回答1: Except on OSX, what you want can

ttk creating and using a custom theme

ⅰ亾dé卋堺 提交于 2021-02-07 09:48:58
问题 I am trying to incorporate a customizable theme choice in my program. I have been referring to this guide: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/ttk-themes.html, but I am lost. Here is a sample code I have been using to try to figure this out. I created a new theme, "Shadow," correctly, but the next part I'm struggling with. Let's just keep it simple and say within the "Shadow" theme I would like to change the frame background to black, the button background to navy and the button

How to change foreground color of a ttk button that is disabled?

限于喜欢 提交于 2021-02-05 11:27:05
问题 When I disable a button the color change automatically to black. This is the code : from tkinter import * from tkinter import ttk root=Tk() style=ttk.Style() style.configure('TButton', foreground='red') bu1=ttk.Button(root, text="Hello world") bu1.grid(row=0, column=0) bu2=ttk.Button(root, text="Hello world2") bu2.grid(row=1, column=0) bu1.state(['disabled']) bu2.state(['disabled']) root.mainloop() Any help? 回答1: Since you are using a ttk button, you can map certain attributes to different

Python: Changing ttk button color depending on current color?

耗尽温柔 提交于 2021-02-05 09:32:28
问题 I'm trying to do some things with styling in ttk for the first time. My goal just now is to highlight the background color of some styled buttons when the mouse goes over them, but the button has some states and will have different colors at different moments, so I tried this: code for the button from PIL.ImageTk import PhotoImage import tkinter.ttk as ttk from random import random class ImgButton(ttk.Button): def __init__(self, master=None, **kw): super().__init__(master, **kw) self.img = kw

How to convert .exe file to windows setup wizard

痞子三分冷 提交于 2021-02-05 05:31:29
问题 I was creating an app through Tkinter. And after making I converted into .exe file using pyinstaller. It is good but I want to make it more professional. Like when we download any application from internet and open it it opens a setup wizard with license agreements and where to put all the files. I do not want to share my exe file but want to share my setup file. So, that when they click it will show license agreements, the path to save, and a few more like a real setup wizard. Please help me

Change width of dropdown listbox of a ttk combobox

家住魔仙堡 提交于 2021-02-05 04:45:39
问题 I am trying to change to width of the popdown list of the ttk Combobox. Setting the width of the Combobox also changes the width of the Listbox, making part of the values unreadable. I read this solution in Tk/Tcl but I am not familiar with this language and would like to solve the problem with Python. I tried changing the theme parameters but it does not seem to help. Below is a piece of sample code. import tkinter as tk from tkinter import ttk root = tk.Tk() root.title("testing the combobox