Topic was automatically imported from the old Question2Answer platform.
Asked By
RetroDan007
Old Version
Published before Godot 3 was released.
Hello everyone.
I am creating a calculator as practice.
And I ready design it.
I created custom buttons in blender ,
And GODOT and implemented by the node
TextureButton . To put a sprite screen as background and an empty Label,
It is this correct , or suggest me something else.
My questions are:
How do I make a button that when tighten show the number
Example : 1,2,3,4,5,6,7,8,9,10
I did this for the button 1 and 2:
_on_1_pressed func ():
get_node ( " Label" ) . set_text ( “1” )
var Node = get_node("Label")
Node.set_text(str(Node.get_text(), "1"))
This way when you press “1” it’ll add, and not replace.
Some hints about questioning:
Do not use vague titles such as “Godot Script”
When giving code samples, select the code and click on the two
brackets where is the bold and italic buttons as well.
Be direct and try to make your text as legible as possible.
If you get your answer click on the circle with the “V” to mark it
as best answer. This way you prevent other people from entering here
thinking you still need help.
Invalid call to function ‘set_text’ in base ‘Label’. Expected 1 arguments.
extends Node
# member variables here, example:
# var a=2
# var b="textvar"
var memory_01
var signo
var memory_02
func _ready():
# Called every time the node is added to the scene.
# Initialization here
pass
func _on_1_pressed():
var Node = get_node("Label")
Node.set_text(Node.get_text(),"1")
e
func _on_2_pressed():
var Node = get_node("Label")
Node.set_text(Node.get_text(),"2")
func _on_3_pressed():
var Node = get_node("Label")
Node.set_text(Node.get_text(),"3")
RetroDan007 | 2016-05-11 00:41
Try
var Node = get_node("Label")
Node.set_text(str(Node.get_text(), "1"))