user-interface

What's the difference between Entry() and Text()?

十年热恋 提交于 2020-06-28 05:45:12
问题 What's the difference between tkinter's Entry() and Text() functions? Couldn't find anything online, so after figuring it out, wanted to make it available online for others. 回答1: Entry() allows one line of input: Whereas, Text() allows multi-line inputs: 回答2: Any documentation on Tkinter will tell you the answer. In fact, it's usually literally the very first thing it will tell you. Entry in the Tkinter Book starts off with: The Entry widget is a standard Tkinter widget used to enter or

tkinter treeview click event for selected item [duplicate]

こ雲淡風輕ζ 提交于 2020-06-28 04:17:25
问题 This question already has answers here : Command for clicking on the items of a Tkinter Treeview widget? (3 answers) Closed 10 months ago . In my small tkinter app I have tree with such scructure as in the picture below. I want to make click event only when user will double click to last item of the tree (Amount1 or Amount2 etc.) Unfortunatly click event works when I click any item of the tree. How fix this behavior?! CODE: self.treeView.insert('', 'end', "parent", text=text) first_child =

Python Tkinter, Display Live Data

耗尽温柔 提交于 2020-06-27 19:39:27
问题 I want to display live data in a GUI, in tkinter . The data I am getting contains a list of two integers [current, voltage] . I am getting new data every second. I managed to create a GUI, now I want to know how to display data in GUI Label widgets (python tkinter) and update labels dynamically. Any suggestions please Here is my code so far: #data getting is a list eg. [10, 12] from tkinter import * import tkinter.font #main Window using Tk win = Tk() win.title("v1.0") win.geometry('800x480')

Disabling a button but visually keeping it as if it wasn't disabled

﹥>﹥吖頭↗ 提交于 2020-06-27 12:27:20
问题 for my board game, I need to press a certain button and after that, disable it (to prevent the user or the computer to place a "peace" in the same place). The problem I have with this is basically design-wise: as you would know, when a button is disabled in tkinter, it turns grayed-out, kinda "visually blocking" the piece I placed... Here is an image of what I'm talking about: My question is, how would I disable a button, but keep it as if it wasn't disabled? I searched and the only answer I

Disabling a button but visually keeping it as if it wasn't disabled

微笑、不失礼 提交于 2020-06-27 12:26:30
问题 for my board game, I need to press a certain button and after that, disable it (to prevent the user or the computer to place a "peace" in the same place). The problem I have with this is basically design-wise: as you would know, when a button is disabled in tkinter, it turns grayed-out, kinda "visually blocking" the piece I placed... Here is an image of what I'm talking about: My question is, how would I disable a button, but keep it as if it wasn't disabled? I searched and the only answer I

Svelte route gives me 404

北慕城南 提交于 2020-06-27 09:15:17
问题 I created a simple router for my app in Svelte. It is working if I'm accessing the link from the nav bar. If I reload the page, it give me 404.. why ? <Router url="{url}"> <nav> <Link to="/">Home</Link> <Link to="charts">About</Link> </nav> <div> <Route path="charts" component="{About}" /> <Route path="/"><Home /></Route> </div> </Router> After reload: This localhost page can’t be found No webpage was found for the web address: http://localhost:5000/charts 回答1: You must make sure your server

how to Clear graph tkinter

☆樱花仙子☆ 提交于 2020-06-26 14:11:47
问题 well with this code I want to make dynamic graph, I want to make my graph clear every 60 second, but I cant make it work with cla() and clf(), what is wrong? is there any otherway to clear graph except using cla() and clf()? #import lib client paho mqtt from Tkinter import * from ttk import * from datetime import datetime import matplotlib import paho.mqtt.client as mqtt import redis, time from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.figure import Figure

how to Clear graph tkinter

老子叫甜甜 提交于 2020-06-26 14:09:16
问题 well with this code I want to make dynamic graph, I want to make my graph clear every 60 second, but I cant make it work with cla() and clf(), what is wrong? is there any otherway to clear graph except using cla() and clf()? #import lib client paho mqtt from Tkinter import * from ttk import * from datetime import datetime import matplotlib import paho.mqtt.client as mqtt import redis, time from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.figure import Figure

Custom JComponent (A Line) Doesn't Show Up On JPanel

China☆狼群 提交于 2020-06-26 12:26:52
问题 It shows the line without jpanel on jframe, but it doesn't when I add it to jpanel. I've tried setting the layout manager of jpanel to null but no result. I want to use JComponents for drawing lines because I want them clickable. Main.java file: import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import javax

Custom JComponent (A Line) Doesn't Show Up On JPanel

£可爱£侵袭症+ 提交于 2020-06-26 12:24:59
问题 It shows the line without jpanel on jframe, but it doesn't when I add it to jpanel. I've tried setting the layout manager of jpanel to null but no result. I want to use JComponents for drawing lines because I want them clickable. Main.java file: import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import javax