ttk

ttk Entry widget ignores font applied via style?

微笑、不失礼 提交于 2020-01-30 08:27:33
问题 from tkinter import Tk from tkinter.ttk import Style, Entry import tkinter.font as tkfont root = Tk() font = tkfont.Font(family='Helvetica', size=30, slant='italic') style = Style() style.configure('Custom.TEntry', font=font, foreground='green') entry_font = Entry(root, font=font, foreground='green') entry_font.insert(0, 'directly configured') entry_font.pack() entry_style = Entry(root, style='Custom.TEntry') entry_style.insert(0, 'styled entry') entry_style.pack() root.mainloop() The first

How to make border around ttk.OptionMenu

烈酒焚心 提交于 2020-01-24 09:50:27
问题 While trying to make an entry frame I ran into a problem where I can't make border around ttk.OptionMenu in order to make it look similiar to ttk.Entry. (The two next to each other are in image) Making OptionMenu option = ttk.OptionMenu(bottom_container, self.have, 'ANY', 'ANY', '0', '1', style='vista.TMenubutton') option.grid(column=1, row=2, sticky='we') I tried using styles (want to still use vista/winnative look) and was able to make the optionmenu background white, but I couldn't find a

Are Python tkinter ttk themes available based on the operating system

心已入冬 提交于 2020-01-24 05:24:26
问题 I'm using Python 3.5.2 with the tkinter.ttk module to develop a simple GUI utility on Linux (Kubuntu 16.04). My ttk.__version__ == 0.3.1 . There are four widget themes available: 'clam', 'alt', 'classic', 'default' . I had seen elsewhere that other installations have more to choose from. Is that something available for download and install for every OS? I'm wondering if other themes aren't necessarily cross-platform, and might be designed for certain OS? Note : I'm new to writing a GUI. 回答1:

How can I change the size of tab caption box and font of ttk notebook tabs?

泪湿孤枕 提交于 2020-01-22 03:37:36
问题 I want to change the font, width and height of a tab caption in ttk.notebook python 3x by below code, i can just change the width of tab caption box text=f'{"frame 1": ^30s} but how i can change the font of "frame 1" and also the height of tab caption box? import tkinter as tk from tkinter import ttk root = tk.Tk() notebook = ttk.Notebook(root) f1 = tk.Frame(notebook, bg='red', width=200, height=200) f2 = tk.Frame(notebook, bg='blue', width=200, height=200) notebook.add(f1, text=f'{"frame 1":

Why ttk Progressbar appears after process in Tkinter

99封情书 提交于 2020-01-20 04:19:24
问题 I want to create a large text upon Tkinter menu command and provide visual support by a progress bar. Although the progress bar is meant to start before the subsequent time-consuming loop, the progress bar shows up only after the large text was created and displayed. def menu_bar(self): self.create_menu.add_command(label="Create large file", command=self.create_large_file) def create_large_file(self): self.progressbar = ttk.Progressbar(self.master, mode='indeterminate') self.progressbar.pack(

Align tabs from right to left using ttk.Notebook widget

假如想象 提交于 2020-01-11 02:05:08
问题 I want to align tabs (panes) inside a ttk.Notebook widget from right to left (the default is from left to right). How might this be done? Below is my current code: import Tkinter as tk import ttk root = tk.Tk() root.minsize(300, 300) root.geometry("1000x700") box = ttk.Notebook(root, width=1000, height=650) tab1 = tk.Frame(root) tab2 = tk.Frame(root) tab3 = tk.Frame(root) box.add(tab1, text="tab1") box.add(tab2, text="tab2") box.add(tab3, text="tab3") box.pack(side=tk.TOP) root.mainloop() 回答1

How to get FLAT relief Entry widget in python ttk?

霸气de小男生 提交于 2020-01-05 08:25:26
问题 I am writing a GUI FTP client app in python ttk. I can't seem to get the text Entries the way I wanted them to. The text Entries have the "SUNKEN" effect. I want to adjust the height and get the text entries to have a "FLAT" look, more like this program: I got the buttons to look flat from here, I am struggling to get the Entries to look flat. How do I get the Entries to look flat? I don't want a tk solution, I know how to set relief FLAT in tk. 回答1: Trivia: Appereance of ttk widgets heavily

How to start ttk.Progressbar?

☆樱花仙子☆ 提交于 2020-01-04 14:19:10
问题 I am having trouble with getting the progressbar to start. I have scoured the internet for answers, and have tried multiple ways for hours, but have been rewarded with errors such as: TypeError: unbound method start() must be called with Progressbar instance as first argument (got nothing instead) TypeError: unbound method start() must be called with Progressbar instance as first argument (got NoneType instance instead) AttributeError: 'NoneType' object has no attribute 'stop' Here is

More on tkinter optionmenu first option vanishes

谁说我不能喝 提交于 2020-01-04 09:18:58
问题 This is a followup to my question here. I'm trying to use ttk.OptionMenu to enhance the look and feel of a dropdown menu. But as noted in the post here, "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..." The workaround as suggested in that post is to add an empty item to the list. In my case, since I am using a dictionary, adding '':[] as the first item in the dictionary fixed the

Button commands in Tkinter

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-04 06:25:13
问题 I'm trying to make a text adventure with tkinter and I'm slowly getting something together. I'm trying to display commands as they come from room to room but even though the buttons appear, nothing happens when I press them. game.py #!/usr/bin/python # -*- coding: utf-8 -*- import world from player import Player from ui import * def main(): gui = Window(root()) while True: gui.mainloop() else: pass if __name__ == '__main__': main() ui.py #!/usr/bin/python # -*- coding: utf-8 -*- import