ttk

How should a scrollable spreadsheet be displayed within Tkinter?

一笑奈何 提交于 2019-12-11 04:13:14
问题 Currently I am using a Treeview. The problem is that I am using quite a large data set. So that the GUI isn't massive, I've limited the size of the Treeview to fit the window and added vertical and horizontal scrollbars. It displays the data exactly how I want, however there are speed issues when scrolling in each direction. Is there a better/faster way to display spreadsheet-like data. 回答1: The below solution is cobbled together but should achieve the desired result: from tkinter import *

Setting Tkinter/ttk Frame background color

爷,独闯天下 提交于 2019-12-11 02:51:19
问题 I'm trying to change the background color of a ttk frame and I've looked up other examples, but none have seemed to work. This is my code so far: from Tkinter import * import ttk p = Tk() p.geometry('600x350') p.configure(bg='#334353') gui_style = ttk.Style() gui_style.configure('My.TButton', foreground='#334353') gui_style.configure('My.TFrame', background='#334353') frame = ttk.Frame(p, style='My.TFrame') frame.grid(column=1, row=1) ttk.Button(frame, text='test', style='My.TButton').grid

how to UNSELECT row in a ttk.Treeview in tkinter

半城伤御伤魂 提交于 2019-12-11 02:47:11
问题 Once I click into a ttk.Treeview() and select a row, I can click another row but there is no way for me to UNSELECT all the rows, there will always be at least 1 row selected. is there a clever way to allow unselecting the last selected row? 回答1: Change the name of your var i use treeview=ttk.Treeview() and put in a button [UNSELECT ALL] the following code: treeview.selection_clear() 来源: https://stackoverflow.com/questions/45376198/how-to-unselect-row-in-a-ttk-treeview-in-tkinter

can I change the color of python ttk combobox under windows?

寵の児 提交于 2019-12-11 01:39:03
问题 I got working code under Linux to change the appearance of a TCombobox of Ttk under python 2.7. If I run the code under windows, it wont work. Im aware, that colors and also attributes of the ttk widgets are platform-dependant. Still I cannot figure out how to change the color of either the textarea or the downarrow of the combobox under windows. The code, which is working under linux is like that: self = Tkinter.Canvas style = ttk.Style() style.configure('Yellow.TCombobox',background="yellow

Is it possible to scroll Treeview's column content, not column window in Tkinter?

两盒软妹~` 提交于 2019-12-11 01:13:55
问题 I have a window with Treeview widget and a column. If I add enough nodes so that node's text extends beyond window's width, it'll not be possible to scroll horizontally unless I change column width to make it wider than the window width . Here's what I mean: I should be able to scroll horizontally so I can accomodate for the node's text, but the horizontal scroll bar is disabled. However, if I manully resize the column itself, I'll be able to scroll until I reach the column's right border.

Python 3 - How do I use tkinter progressbar with a bat file?

本小妞迷上赌 提交于 2019-12-10 23:52:32
问题 So far, the bat runs but the progress bar doesn't. How do I connect the two with each other? Here is the image of the output. http://imgur.com/lKbHepS from tkinter import * from tkinter import ttk from subprocess import call def runBat(): call("mp3.bat") root = Tk() photobutton3 = PhotoImage(file="smile.png") button3 = Button(root, image=photobutton3, command=runBat) button3.grid() pbar = ttk.Progressbar(root, orient=HORIZONTAL, length=200, mode='determinate') pbar.grid() root.mainloop() 回答1:

Deleting certain rows/columns in a grid Tkinter

我的梦境 提交于 2019-12-10 22:56:41
问题 If I have several rows and columns with several entry/label widgets in the SAME frame, is it possible to choose just a single one of them and delete it whilst leaving the others alone. e.g. class Window(): def __init__(self): self.root = Tk() self.win1 = Frame(self.root) entry1 = Entry(win1, row=1, column=1) entry2 = Entry(win1, row=1, column=2) label1 = Label(win1, row=1, column=3) def main1(self): label2 = Label(win1, row=1, column=4) labeln = Label(win1, row=1, column=n) I would then like

How do I change ttk.LabelFrame's blue header label to black in python's tkinter 8.5

三世轮回 提交于 2019-12-10 21:31:00
问题 I'm using tkinter 8.5 and python 3.3 on a Windows 7 machine. The code below renders the Labelframe's header in a blue font color. from tkinter import * from tkinter import ttk root = Tk() lf = ttk.LabelFrame(root, text="Why is this blue?") lf.pack() label = ttk.Label(lf, text="label") label.pack() I tried fixing this by adding a ttk.Style(), but got an unexpected display: from tkinter import * from tkinter import ttk root = Tk() s = ttk.Style() s.configure('TLabelframe.Label', font='arial 14

Combining grid/pack Tkinter

…衆ロ難τιáo~ 提交于 2019-12-10 14:11:53
问题 I know there have been many questions on grid and pack in the past but I just don't understand how to combine the two as I'm having difficulties expanding my 'table' in both directions (row/column). Buttons I wish to keep the same size but always stay at the bottom of the window. The 'table' however I wish to expand automatically with resizing the window but can't seem to make it work. Changing 'win1' to pack worked in the sense that it stays central but that's it. How can I achieve the same

ttk.Treeview - Can't change row height

孤街浪徒 提交于 2019-12-10 13:18:51
问题 I'm using ttkcalendar.py which can be found in this link. I've adapted it for use in Python 3.3 Basically what i'm trying to do is enter this calendar widget into my Tkinter application, which works fine and there's no problems there. The problems I wish to overcome are: How do I change the font size of the calendar (Month,Days & Dates) - Completed How do I change the selected date so it goes bold . - Completed How can I change the height of the rows in the treeview as in prevoius attempts