tkinter

How can I dynamically update ttk.combobox?

我的梦境 提交于 2021-02-10 13:24:08
问题 I am creating a GUI using Python 3.4 and Tkinter on a Windows 8 computer. The GUI has some Entry inputs at the top, then some comboboxes. I want the combobox to acquire a list of options from a text file that is described by the previous inputs (file name, the row in which the requisite information is found, delimiter type, etc.). I am trying to use the postcommand, but it seems to run first thing and never update, rather then update every time I access the drop down menu of the combobox.

Clearing and plotting mathplot figure on tkinter

风格不统一 提交于 2021-02-10 12:58:00
问题 I need some help for my current code. I want to create a window by tkinter and show a plot in a canvas I created by matplotlib before. This point I reached yet. My problem is that I want to clear this canvas by hitting a button. To clear a canvas I suppose to initialize this before I can fill it with the plot. So my question is: How can I fill a plot in a created canvas? Below you can find a small code that shows my state of arts. from matplotlib.figure import Figure from matplotlib.backends

Clearing and plotting mathplot figure on tkinter

半世苍凉 提交于 2021-02-10 12:57:16
问题 I need some help for my current code. I want to create a window by tkinter and show a plot in a canvas I created by matplotlib before. This point I reached yet. My problem is that I want to clear this canvas by hitting a button. To clear a canvas I suppose to initialize this before I can fill it with the plot. So my question is: How can I fill a plot in a created canvas? Below you can find a small code that shows my state of arts. from matplotlib.figure import Figure from matplotlib.backends

Clearing and plotting mathplot figure on tkinter

為{幸葍}努か 提交于 2021-02-10 12:57:04
问题 I need some help for my current code. I want to create a window by tkinter and show a plot in a canvas I created by matplotlib before. This point I reached yet. My problem is that I want to clear this canvas by hitting a button. To clear a canvas I suppose to initialize this before I can fill it with the plot. So my question is: How can I fill a plot in a created canvas? Below you can find a small code that shows my state of arts. from matplotlib.figure import Figure from matplotlib.backends

Updating matplotlib plot in tkinter gui via another process

吃可爱长大的小学妹 提交于 2021-02-10 10:13:04
问题 I have an interface that I am writing using tkinter. Inside that interface, I have a matplotlib plot. In the background, I have zmq connecting to a server to get data. I am using python's multiprocessing module with a Queue sharing data and a Process running for all of the zmq communication. In the GUI, I can set up a button to update the plot with the following function: def addData(self): if not self.data.empty(): print "Have Data!" self.hist.addQueue(self.data) self.hist.updatePlot() else:

Embedding an animated matplotlib in tk

别说谁变了你拦得住时间么 提交于 2021-02-10 09:37:28
问题 I am fairly new to python and a real beginner to tkinter and matplotlib. I have the following code which essentially is a testbed for what I eventually want to do. #!/usr/bin/env python import numpy as np from matplotlib import pyplot as plt import time top = 100 plt.ion () # set plot to animated xdata = [] c = 0 for a in range(0,top): xdata.append(a) c+=1 ydata = [ 0 ] * top * 10 ax1 = plt.axes () c = 0 myfile = open("rdata.txt", "r") for myline in myfile: q = myline ydata[c] = q c+=1 c = 0

Tkinter: calling destroy() during resize resets the window to original shape

大城市里の小女人 提交于 2021-02-10 08:45:14
问题 In a Tkinter GUI, during window resizing at runtime, I've noticed that the removal of a widget or a frame, using my_widget.destroy() , resets the window size to the original shape (the one it had at the start of the resizing). I've found an identical question HERE, with no solution. Couldn't find anything else online. Is there a way of calling a destroy without interrupting the resize action and resetting the size? Here is a sample code to test this behavior (creates an empty window of width

Tkinter is opening multiple GUI windows upon file selection with multiprocessing, when only one window should exist

强颜欢笑 提交于 2021-02-10 08:16:01
问题 I have primary.py: from tkinter import * from tkinter.filedialog import askopenfilename from tkinter import ttk import multiprocessing as mp import other_script class GUI: def __init__(self, master): self.master = master def file_select(): path = askopenfilename() if __name__ == '__main__': queue = mp.Queue() queue.put(path) import_ds_proc = mp.Process(target=other_script.dummy, args=(queue,)) import_ds_proc.daemon = True import_ds_proc.start() # GUI root = Tk() my_gui = GUI(root) # Display

Tkinter is opening multiple GUI windows upon file selection with multiprocessing, when only one window should exist

核能气质少年 提交于 2021-02-10 08:12:30
问题 I have primary.py: from tkinter import * from tkinter.filedialog import askopenfilename from tkinter import ttk import multiprocessing as mp import other_script class GUI: def __init__(self, master): self.master = master def file_select(): path = askopenfilename() if __name__ == '__main__': queue = mp.Queue() queue.put(path) import_ds_proc = mp.Process(target=other_script.dummy, args=(queue,)) import_ds_proc.daemon = True import_ds_proc.start() # GUI root = Tk() my_gui = GUI(root) # Display

Tkinter is opening multiple GUI windows upon file selection with multiprocessing, when only one window should exist

。_饼干妹妹 提交于 2021-02-10 08:10:01
问题 I have primary.py: from tkinter import * from tkinter.filedialog import askopenfilename from tkinter import ttk import multiprocessing as mp import other_script class GUI: def __init__(self, master): self.master = master def file_select(): path = askopenfilename() if __name__ == '__main__': queue = mp.Queue() queue.put(path) import_ds_proc = mp.Process(target=other_script.dummy, args=(queue,)) import_ds_proc.daemon = True import_ds_proc.start() # GUI root = Tk() my_gui = GUI(root) # Display