tkinter

How to call and close a virtual keyboard made by Tkinter using touchscreen display

こ雲淡風輕ζ 提交于 2021-01-07 05:44:05
问题 I'm having a problem with opening and closing the virtual keyboard made with Tkinter. I'm creating a GUI the user will browse it using touchscreen display and the user needs to input on entries. I've tried var_name.bind('FocusIn', callback) to call the virtual keyboard and var_name.bind('FocusOut',callback) to close the virtual keyboard but when I used both the virtual keyboard is opening and then closing right away. I hope you guys can help me here's my code: import tkinter as tk def select

How to remove focus out of a Text widget in Tkinter, Python

亡梦爱人 提交于 2021-01-07 03:43:15
问题 By placing a Text widget in my GUI from Tkinter import Text textBox=Text(root, height=20, width=10) textBox.pack() whenever I write something in that box, I cant return the focus back to any other place in the window. I have some keys bounded to event, which stop working after I wrote in the Text widget. Is there a way of redirecting the focus to another place after writing text? 回答1: Is there a way of redirecting the focus to another place after writing text? Every widget has a method named

How to remove focus out of a Text widget in Tkinter, Python

耗尽温柔 提交于 2021-01-07 03:41:43
问题 By placing a Text widget in my GUI from Tkinter import Text textBox=Text(root, height=20, width=10) textBox.pack() whenever I write something in that box, I cant return the focus back to any other place in the window. I have some keys bounded to event, which stop working after I wrote in the Text widget. Is there a way of redirecting the focus to another place after writing text? 回答1: Is there a way of redirecting the focus to another place after writing text? Every widget has a method named

How to disable a TKinter scrollbar widget?

断了今生、忘了曾经 提交于 2021-01-07 03:21:34
问题 I am writing a single thread program with a GUI, which executes a series of tasks. During these tasks the GUI is refreshed regularly to check for a few available inputs (e.g. abort). To avoid halting the task with unwanted inputs all unnecessary GUI elements are disabled by .config(state='disabled') during execution. This however does not seem work for scrollbars which for some reason are unique and don't have a "-state" option. 回答1: I think you can't disable the scrollbar widget using the

How to disable a TKinter scrollbar widget?

天涯浪子 提交于 2021-01-07 03:21:08
问题 I am writing a single thread program with a GUI, which executes a series of tasks. During these tasks the GUI is refreshed regularly to check for a few available inputs (e.g. abort). To avoid halting the task with unwanted inputs all unnecessary GUI elements are disabled by .config(state='disabled') during execution. This however does not seem work for scrollbars which for some reason are unique and don't have a "-state" option. 回答1: I think you can't disable the scrollbar widget using the

Ttk Indeterminate progress bar on button press

孤街醉人 提交于 2021-01-07 02:39:46
问题 I am trying to create a progress bar that runs as long as my function is running to show the user that things are happening and not just frozen. My function (generate_reports) makes queries to the database and writes to CSV files. Here is an abstract version of my code: from tkinter import * from tkinter import ttk from billing import generate_reports class app: def __init__(self, root): self.mainframe = ttk.Frame(root, padding = '4 4 12 12') self.mainframe.grid(column = 0, row = 0, sticky =

How to display images in grid from a loop in tkinter

你。 提交于 2021-01-07 01:38:55
问题 i want to display images in row and columns...row should be of 4...the number of images will be random.. import tkinter as tk from PIL import Image, ImageTk from urllib.request import urlopen from io import BytesIO root = tk.Tk() #number of urls will be random URL_list = ["urls","urls","urls"] for url in URL_list: u = urlopen(url) raw_data = u.read() u.close() im = Image.open(BytesIO(raw_data)) photo = ImageTk.PhotoImage(im) label = tk.Label(image=photo) label.image = photo label.pack() root

How to display images in grid from a loop in tkinter

心不动则不痛 提交于 2021-01-07 01:35:34
问题 i want to display images in row and columns...row should be of 4...the number of images will be random.. import tkinter as tk from PIL import Image, ImageTk from urllib.request import urlopen from io import BytesIO root = tk.Tk() #number of urls will be random URL_list = ["urls","urls","urls"] for url in URL_list: u = urlopen(url) raw_data = u.read() u.close() im = Image.open(BytesIO(raw_data)) photo = ImageTk.PhotoImage(im) label = tk.Label(image=photo) label.image = photo label.pack() root

How can a Tkinter work with a Listener together?

给你一囗甜甜゛ 提交于 2021-01-06 18:22:43
问题 I have written a Tkinter and I hope to have a Listener to monitor the Keyboard Input by Users. But when I use mainloop() to start the Tkinter, the Listener cannot work together with it, and will start until I quit Tkinter. I have tried to add this Listener in Tkinter sub-unit, but it does not work as the same. def initialization(): print("Starting...") print("Start listener...") with mouse.Listener(on_click=onMouseClick) as listener: listener.join() if __name__ == "__main__" : root = tk.Tk()

How to remove icursor from Tkinter canvas text item?

泪湿孤枕 提交于 2021-01-05 09:26:05
问题 I'm following along with Effbot's Tkinter page here: http://effbot.org/zone/editing-canvas-text-items.htm The trouble I'm having is that after inserting the icursor, I can't seem to get it to go away! How do I stop editing altogether? As for examples, the one from the linked page will work: # File: canvas-editing-example-1.py # # editing canvas items # # fredrik lundh, december 1998 # # fredrik@pythonware.com # http://www.pythonware.com # from tkinter import * #Change to Tkinter to use python