那么,我们如何能够从1到10个箱中获得价值,然后将其成一个箱(最大:100)? 之后,结果又出现在TKINTER的文字箱中?
我尝试了.get(
)方法以获得这一数值,然后我将其乘以100。 然后,我使用<代码>.insert()方法,显示结果形成一个文本箱,但该文本却做了一些工作。
那么,我们如何能够从1到10个箱中获得价值,然后将其成一个箱(最大:100)? 之后,结果又出现在TKINTER的文字箱中?
我尝试了.get(
)方法以获得这一数值,然后我将其乘以100。 然后,我使用<代码>.insert()方法,显示结果形成一个文本箱,但该文本却做了一些工作。
How can we get the value of a Spinbox (from 1 to 10) then multiply it into a number (ex: 100)
I tried the .get() method to get the value, then I multiplied it by 100. Then I used the .insert() method to display the result in a textbox, but it didn t work that well
Spinbox
, Text
and Button
value_changed
Edit: re-work in value_changed()
Snippet:
import tkinter as tk
from tkinter import ttk
# root window
root = tk.Tk()
root.geometry( 300x200 )
root.resizable(False, False)
root.title( Spinbox Demo )
def value_changed():
cal = current_value.get()
y = 100
ca= int(cal) * y
textbox.insert(tk.END, ca)
textbox = tk.Text(root, width=25, height=5)
btn = tk.Button(root, text=r Click , command= value_changed)
# Spinbox
current_value = tk.StringVar(value=1)
spin_box = ttk.Spinbox(
root,
from_=1,
to=10,
textvariable=current_value,
wrap=True)
spin_box.pack()
textbox.pack()
btn.pack(pady =10)
root.mainloop()
检查:
How do you set the Textbox read only property to true or false using JavaScript in ASP.NET?
I m using the following code to check if a valid date has been typed into a textbox: public bool ValidateDate(Control ctrl) { if (!string.IsNullOrEmpty(ctrl.Text)) { DateTime value; ...
Is it possible to set the opacity of a button or textbox? I know that you can set the opacity for a form, but I m not so sure about a button or textbox.
I have been working on my custom control derived from the TextBox and I have encountered a problem I can not solve right now. Brief description of the problem: my textbox contains plain text which ...
I have an application that logs messages to the screen using a TextBox. The update function uses some Win32 functions to ensure that the box automatically scrolls to the end unless the user is viewing ...
I m successfully getting a TextBox to resize with a parent Border height but I need the TextBox to actually be 50 pixels smaller in height than the parent Border. Any ideas how to achieve this? The ...
I need a WPF Textbox that displays a phone number as "(555) 555-5555" but has a value of "5555555555". All of the examples I m seeing have the ability to mask the control on the UI but that affects ...
Okay the code is, code in first.php <?PHP session_start(); include("script.php"); ?> <form action="script.php" method=POST> <input type="text" value="<?PHP if(isset($_SESSION[ ...