tkinter

Reading serial input and printing to Tkinter GUI

。_饼干妹妹 提交于 2021-02-10 23:21:06
问题 I'm trying to make a Tkinter based GUI for an Arduino printing sensors value and responding to user input. The code I'm trying to use to eliminate while loops is this, which doesn't print any sensor information, the only output is "Trying.../dev/ttyACM0" followed by the tkinter window opening. import serial import time from Tkinter import * connected = False write_to_file_path = "output.txt" output_file = open(write_to_file_path, "w+") locations=['/dev/ttyACM0','/dev/ttyACM1','/dev/ttyACM2','

Reading serial input and printing to Tkinter GUI

陌路散爱 提交于 2021-02-10 23:15:59
问题 I'm trying to make a Tkinter based GUI for an Arduino printing sensors value and responding to user input. The code I'm trying to use to eliminate while loops is this, which doesn't print any sensor information, the only output is "Trying.../dev/ttyACM0" followed by the tkinter window opening. import serial import time from Tkinter import * connected = False write_to_file_path = "output.txt" output_file = open(write_to_file_path, "w+") locations=['/dev/ttyACM0','/dev/ttyACM1','/dev/ttyACM2','

Change Title Bar on a Tk window

元气小坏坏 提交于 2021-02-10 20:35:37
问题 Im trying to make the top bar of my Tk window say calculator instaed of Tk is there anyway to do that also can i change the little icon beside it to a differnt image if not the title would just be fine Thank you Here is the code: import math def calculate(): try: num1 = float(enter1.get()) num2 = float(enter2.get()) result = num1 * num2 label3.config(text=str(result)) except ValueError: label3.config(text='Enter numeric values!') def calculate2(): try: num1 = float(enter1.get()) num2 = float

Change Title Bar on a Tk window

[亡魂溺海] 提交于 2021-02-10 20:31:11
问题 Im trying to make the top bar of my Tk window say calculator instaed of Tk is there anyway to do that also can i change the little icon beside it to a differnt image if not the title would just be fine Thank you Here is the code: import math def calculate(): try: num1 = float(enter1.get()) num2 = float(enter2.get()) result = num1 * num2 label3.config(text=str(result)) except ValueError: label3.config(text='Enter numeric values!') def calculate2(): try: num1 = float(enter1.get()) num2 = float

Defining TkInter StringVars in a loop

自古美人都是妖i 提交于 2021-02-10 20:22:29
问题 My program iterates through a list of values and creates a new frame with relevant information. I want to add a button to refresh the values in just one of the frames. The following image is a mockup of what I'm trying to achieve, where the "reload" button grabs new data for just one printer. I'm running into an issue where only the last values get updated. The following code is an approximation of what I was trying: import tkinter as tk from tkinter import ttk def buttonupdate(x): return int

Defining TkInter StringVars in a loop

≡放荡痞女 提交于 2021-02-10 20:20:35
问题 My program iterates through a list of values and creates a new frame with relevant information. I want to add a button to refresh the values in just one of the frames. The following image is a mockup of what I'm trying to achieve, where the "reload" button grabs new data for just one printer. I'm running into an issue where only the last values get updated. The following code is an approximation of what I was trying: import tkinter as tk from tkinter import ttk def buttonupdate(x): return int

Memory increases with matplotlib and tkinter

别来无恙 提交于 2021-02-10 18:49:09
问题 Problem: I have a tkinter window with a matplotlib graph showing some lines (part of a much larger program). Periodically I add a new line, deleting an oldest one to limit the number of lines shown. Unfortunately the program grows in size continuously. I've seen this on both Windows and Linux. Question: How should I write a long-running graph frame to show the last n lines which doesn't use up all my memory? Preferably by tweaking the code below, but I'm prepared for a complete re-write if

Memory increases with matplotlib and tkinter

旧时模样 提交于 2021-02-10 18:46:31
问题 Problem: I have a tkinter window with a matplotlib graph showing some lines (part of a much larger program). Periodically I add a new line, deleting an oldest one to limit the number of lines shown. Unfortunately the program grows in size continuously. I've seen this on both Windows and Linux. Question: How should I write a long-running graph frame to show the last n lines which doesn't use up all my memory? Preferably by tweaking the code below, but I'm prepared for a complete re-write if

Python: Tkinter TclError: can't invoke “image” command

只愿长相守 提交于 2021-02-10 16:47:49
问题 preface : I have currently tried most things and there are few qusestions asked on stackoverflow on this question and i cant seem to wrap my head around it so im going to need some help application : the purpose of this program is to animate an oval and a picture, the oval works fine, but the picture is struggling, you could remove the image or alien2 and the program should run fine. CODE image form from tkinter import * import time from PIL import Image,ImageFilter from PIL import ImageTk

A Label in a Frame in a window won't stretch, why?

我的未来我决定 提交于 2021-02-10 16:43:18
问题 I would like to display a window with a single Frame and a Label in the Frame which would stretch to the whole width of the window The following code import Tkinter as tk root = tk.Tk() root.geometry("100x100") # first column of root will stretch root.columnconfigure(0, weight=1) # a frame in root upper_frame = tk.Frame(root) # first column of upper_frame will stretch upper_frame.columnconfigure(0, weight=1) upper_frame.grid(row=0, column=0) # a label in upper_frame, which should stretch