tkinter

Tkinter Treeview heading styling

爱⌒轻易说出口 提交于 2021-02-03 13:36:33
问题 I want to change the background colour of the treeview headings. I have identified the element option of the Treeview.Heading layout responsible for this: Treeheading.cell. The problem is that this setting does not work on the 'vista' theme (Due to drawing issues I assume). working code (theme looks terrible though): from tkinter import * from tkinter import ttk p=Tk() separator = PanedWindow(p,bd=0,bg="#202322",sashwidth=2) separator.pack(fill=BOTH, expand=1) _frame = Frame(p,bg="#383838") t

.get() not working correctly with entry boxes in tkinter

∥☆過路亽.° 提交于 2021-02-02 10:01:43
问题 game_entry = Entry(gs, width = 10, bg = 'white') game_entry.grid(row=4, column = 0, sticky=W) ip = game_entry.get() part1 = partial(click2, ip) Button(gs, text = "Submit", width = 6, command = part1, bg='white').grid(row=5, column = 0, sticky=W) output = Text(gs, width = 25, height = 1, wrap=WORD,bg = 'white') output.grid(row = 7,column=0,sticky=W) def click2(a): if a == 'a': print('hello') If I click the button and the entry box says 'a' (without the quote marks), nothing gets printed and if

.get() not working correctly with entry boxes in tkinter

给你一囗甜甜゛ 提交于 2021-02-02 10:00:00
问题 game_entry = Entry(gs, width = 10, bg = 'white') game_entry.grid(row=4, column = 0, sticky=W) ip = game_entry.get() part1 = partial(click2, ip) Button(gs, text = "Submit", width = 6, command = part1, bg='white').grid(row=5, column = 0, sticky=W) output = Text(gs, width = 25, height = 1, wrap=WORD,bg = 'white') output.grid(row = 7,column=0,sticky=W) def click2(a): if a == 'a': print('hello') If I click the button and the entry box says 'a' (without the quote marks), nothing gets printed and if

.get() not working correctly with entry boxes in tkinter

吃可爱长大的小学妹 提交于 2021-02-02 09:59:09
问题 game_entry = Entry(gs, width = 10, bg = 'white') game_entry.grid(row=4, column = 0, sticky=W) ip = game_entry.get() part1 = partial(click2, ip) Button(gs, text = "Submit", width = 6, command = part1, bg='white').grid(row=5, column = 0, sticky=W) output = Text(gs, width = 25, height = 1, wrap=WORD,bg = 'white') output.grid(row = 7,column=0,sticky=W) def click2(a): if a == 'a': print('hello') If I click the button and the entry box says 'a' (without the quote marks), nothing gets printed and if

Correctly extend a tkinter widget using inheritance

无人久伴 提交于 2021-02-02 03:47:46
问题 Im kinda new to python classes and I dont know how to handle them well yet, and I promise I've done some research to solve this problem but still cant figure out how to. So, here it goes: I'm trying to use python classes to define tkinter widgets so I can implement them rather quickly. It all worked well with buttons and labels but with I cant get it with entries. I'll show you how I've coded buttons and labels to illustrate what im trying to do with entries as well (and maybe you guys can

Correctly extend a tkinter widget using inheritance

社会主义新天地 提交于 2021-02-02 03:42:32
问题 Im kinda new to python classes and I dont know how to handle them well yet, and I promise I've done some research to solve this problem but still cant figure out how to. So, here it goes: I'm trying to use python classes to define tkinter widgets so I can implement them rather quickly. It all worked well with buttons and labels but with I cant get it with entries. I'll show you how I've coded buttons and labels to illustrate what im trying to do with entries as well (and maybe you guys can

Correctly extend a tkinter widget using inheritance

给你一囗甜甜゛ 提交于 2021-02-02 03:42:06
问题 Im kinda new to python classes and I dont know how to handle them well yet, and I promise I've done some research to solve this problem but still cant figure out how to. So, here it goes: I'm trying to use python classes to define tkinter widgets so I can implement them rather quickly. It all worked well with buttons and labels but with I cant get it with entries. I'll show you how I've coded buttons and labels to illustrate what im trying to do with entries as well (and maybe you guys can

How to create zigzag movements in Python?

大兔子大兔子 提交于 2021-01-29 22:53:38
问题 from tkinter import * def move(): global x1, y1, dx, dy, flag, n, z x1, y1 = x1 + dx, y1 + dy if x1 > 360: x1, dx, dy = 360, -15, 5 can1.itemconfig(oval1, fill = "purple") if x1 < 10: x1, dx, dy = 10, 15, 5 can1.itemconfig(oval1, fill = "red") if y1 == 360: x1, dx, dy = 360, -15, -5 can1.itemconfig(oval1, fill = "green") can1.coords(oval1, x1, y1, x1 + 30, y1 + 30) if flag > 0: abl1.after(50, move) def stop(): global flag flag = 0 def start(): global flag if flag == 0: flag = 1 move() ### x1,

How to create zigzag movements in Python?

自古美人都是妖i 提交于 2021-01-29 22:41:24
问题 from tkinter import * def move(): global x1, y1, dx, dy, flag, n, z x1, y1 = x1 + dx, y1 + dy if x1 > 360: x1, dx, dy = 360, -15, 5 can1.itemconfig(oval1, fill = "purple") if x1 < 10: x1, dx, dy = 10, 15, 5 can1.itemconfig(oval1, fill = "red") if y1 == 360: x1, dx, dy = 360, -15, -5 can1.itemconfig(oval1, fill = "green") can1.coords(oval1, x1, y1, x1 + 30, y1 + 30) if flag > 0: abl1.after(50, move) def stop(): global flag flag = 0 def start(): global flag if flag == 0: flag = 1 move() ### x1,

Setting tkinter to always be the current active window

放肆的年华 提交于 2021-01-29 22:26:07
问题 I'm trying to use tkinter as a way to toggle an automation process. The snippet I have below works, but the hotkeys will only work when the tkinter window is the current active window. I found this topic discussing how this can be done, but these methods seem to be OS specific and none seem to work for Windows 10. import tkinter as tk class Automate(tk.Frame): __loop__ = None def __init__(self, master): super(Automate, self).__init__(master) # F7 initiates the loop. self.master.bind('<F7>',