tkinter

Python Tkinter: How do I make my GUI responsive as long as a thread runs?

本秂侑毒 提交于 2021-02-07 08:38:55
问题 For example: import threading import time import Tkinter class MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): print "Step Two" time.sleep(20) class MyApp(Tkinter.Tk): def __init__(self): Tkinter.Tk.__init__(self) self.my_widgets() def my_widgets(self): self.grid() self.my_button = Tkinter.Button(self, text="Start my function", command=self.my_function) self.my_button.grid(row=0, column=0) def my_function(self): print "Step One" mt = MyThread()

Python Tkinter canvas.xview units

十年热恋 提交于 2021-02-07 08:37:45
问题 How are the 'units' ( what ) from the Tkinter canvas scrolling methods xview(SCROLL, step, what) and yview(SCROLL, step, what) defined? Is it defined in pixels? Is it possible to change it (for a slower scrolling for example)? For a better context please see the code here. Thanks in advance. 回答1: for slower scrolling, you can play around with the xscrollincrement & yscrollincrement options of the Canvas: from Tkinter import * root = Tk() c = Canvas(root, scrollregion=(0,0,500,500), height=200

Python Tkinter: How do I make my GUI responsive as long as a thread runs?

大城市里の小女人 提交于 2021-02-07 08:37:00
问题 For example: import threading import time import Tkinter class MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): print "Step Two" time.sleep(20) class MyApp(Tkinter.Tk): def __init__(self): Tkinter.Tk.__init__(self) self.my_widgets() def my_widgets(self): self.grid() self.my_button = Tkinter.Button(self, text="Start my function", command=self.my_function) self.my_button.grid(row=0, column=0) def my_function(self): print "Step One" mt = MyThread()

Python tkinter.filedialog askfolder interfering with clr

余生长醉 提交于 2021-02-07 07:01:22
问题 I'm mainly working in Spyder, building scripts that required a pop-up folder or file Browse window. The code below works perfect in spyder. In Pycharm, the askopenfilename working well, while askdirectory do nothing (stuck). But, if running in debug mode - the script works well. I tried to run the script from SAS jsl - same issue. Any Idea what should I do? Python 3.6 Pycharm 2017.2 Thanks. The Code I'm using includes: import clr #pythonnet 2.3.0 import os import tkinter as tk from tkinter

Python tkinter.filedialog askfolder interfering with clr

▼魔方 西西 提交于 2021-02-07 07:01:08
问题 I'm mainly working in Spyder, building scripts that required a pop-up folder or file Browse window. The code below works perfect in spyder. In Pycharm, the askopenfilename working well, while askdirectory do nothing (stuck). But, if running in debug mode - the script works well. I tried to run the script from SAS jsl - same issue. Any Idea what should I do? Python 3.6 Pycharm 2017.2 Thanks. The Code I'm using includes: import clr #pythonnet 2.3.0 import os import tkinter as tk from tkinter

cx_freeze: can't find a usable init.tcl in the following directories

久未见 提交于 2021-02-07 05:48:05
问题 As far as I'm aware, cx_freeze is the only app able to make Python scripts to .exe files. However, I would like to make a GUI exe in Python 3. And after freezing a simple Tkinter GUI and running the exe, I get the following error: > _tkinter.TclError: Can't find a usable init.tcl in the following directories: > {C:\Users\User\Desktop\tkinter\build\exe.win32-3.1\tcl} > C:/Users/User/Desktop/tkinter/build/exe.win32-3.1/tcl8.5 > C:/Users/User/Desktop/tkinter/build/lib/tcl8.5 > C:/Users/User

Is it possible to input Chinese text into tk Text and Entry widgets with tkinter?

一个人想着一个人 提交于 2021-02-07 04:10:35
问题 I am working on a few GUI apps with tkinter that manipulate Chinese text inputted by the user. I have no problem displaying Chinese text in the app, nor do I have any problem manipulating that text when it is pasted into the app, but when I try to use a Chinese input method to type Chinese text into, e.g., Text or Entry widgets, it shows up as Latin characters instead. It seems like there should be a trivial solution to this problem (or maybe it just doesn't work), but I have spent a lot of

Is it possible to input Chinese text into tk Text and Entry widgets with tkinter?

≯℡__Kan透↙ 提交于 2021-02-07 04:09:13
问题 I am working on a few GUI apps with tkinter that manipulate Chinese text inputted by the user. I have no problem displaying Chinese text in the app, nor do I have any problem manipulating that text when it is pasted into the app, but when I try to use a Chinese input method to type Chinese text into, e.g., Text or Entry widgets, it shows up as Latin characters instead. It seems like there should be a trivial solution to this problem (or maybe it just doesn't work), but I have spent a lot of

Is it possible to input Chinese text into tk Text and Entry widgets with tkinter?

空扰寡人 提交于 2021-02-07 04:05:10
问题 I am working on a few GUI apps with tkinter that manipulate Chinese text inputted by the user. I have no problem displaying Chinese text in the app, nor do I have any problem manipulating that text when it is pasted into the app, but when I try to use a Chinese input method to type Chinese text into, e.g., Text or Entry widgets, it shows up as Latin characters instead. It seems like there should be a trivial solution to this problem (or maybe it just doesn't work), but I have spent a lot of

tkinter with matplotlib

浪子不回头ぞ 提交于 2021-02-07 03:17:28
问题 I read it is possible to embed a pyplot in tkinter, but I'm having a problem: I need to display some frames, among which a pyplot in a frame of the main Tkinter window, and it has to react to my keypresses. According to http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html this works: #!/usr/bin/env python from Tkinter import * import matplotlib matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,