ich bin dabei ein Mathe Trainer zu schreiben.
Und möchte das so machen:
man hat z.b 10 Sekunden um die Aufgabe einzugeben und wenn man das innerhalb der 10 Sekunden nicht schafft, dann soll eine Fehler Meldung kommen und die Aufgabe neu generieren (das generieren das habe ich schon).
weiß jemand von euch wie man einen Timer in das Label schreibt?
code:
Code:
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Mathetrainer v1.2.5", 433, 584, 192, 121)
GUISetBkColor(0xFFFFFF)
$Label2 = GUICtrlCreateLabel("", 16, 40, 4, 4)
$Label3 = GUICtrlCreateLabel("zahl", 16, 48, 55, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("+", 72, 48, 10, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("zahl", 96, 48, 47, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("=", 160, 48, 26, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Neue zahl generieren", 8, 80, 177, 25)
$Label1 = GUICtrlCreateLabel("Mathetrainer addieren (+)", 8, 8, 248, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 192, 48, 81, 21)
$Button2 = GUICtrlCreateButton("Lösung anzeigen", 192, 80, 177, 25)
$Label7 = GUICtrlCreateLabel("Lösung", 376, 88, 55, 17)
$Button3 = GUICtrlCreateButton("aufgabe checken", 280, 48, 89, 25)
$Label8 = GUICtrlCreateLabel("Mathetrainer Subtrahieren (-)", 8, 152, 274, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("_____________________________________________________________________", 0, 112, 418, 17)
$Label10 = GUICtrlCreateLabel("Zahl", 16, 192, 51, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label11 = GUICtrlCreateLabel("-", 72, 192, 9, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label12 = GUICtrlCreateLabel("Zahl", 88, 192, 51, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label13 = GUICtrlCreateLabel("=", 152, 192, 13, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 192, 192, 81, 21)
$Button4 = GUICtrlCreateButton("Aufgabe checken", 280, 192, 91, 25)
$Button5 = GUICtrlCreateButton("Neue Zahl generieren", 0, 224, 185, 25)
$Button6 = GUICtrlCreateButton("Lösung anzeigen", 200, 224, 169, 25)
$Label14 = GUICtrlCreateLabel("Lösung", 376, 224, 39, 17)
$Label15 = GUICtrlCreateLabel("_____________________________________________________________________", 0, 264, 418, 17)
$Label16 = GUICtrlCreateLabel("Mathetrainer multiplizieren (*)", 0, 304, 354, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label17 = GUICtrlCreateLabel("Zahl", 8, 344, 35, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label18 = GUICtrlCreateLabel("*", 72, 344, 10, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label19 = GUICtrlCreateLabel("Zahl", 88, 344, 59, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label20 = GUICtrlCreateLabel("=", 152, 344, 13, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 192, 344, 81, 21)
$Button7 = GUICtrlCreateButton("Aufgabe Checken", 280, 344, 97, 25)
$Button8 = GUICtrlCreateButton("Neue Zahl generieren", 0, 376, 193, 25)
$Button9 = GUICtrlCreateButton("Lösung anzeigen", 208, 376, 169, 25)
$Label21 = GUICtrlCreateLabel("Lösung", 384, 376, 39, 17)
$Label22 = GUICtrlCreateLabel("____________________________________________________________________", 0, 416, 412, 17)
$Label23 = GUICtrlCreateLabel("Mathetrainer Dividieren (/)", 0, 456, 252, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label24 = GUICtrlCreateLabel("Zahl", 16, 496, 35, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label25 = GUICtrlCreateLabel("/", 80, 496, 8, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label26 = GUICtrlCreateLabel("Zahl", 96, 496, 35, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label27 = GUICtrlCreateLabel("=", 152, 496, 13, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input4 = GUICtrlCreateInput("", 192, 496, 81, 21)
$Button10 = GUICtrlCreateButton("Aufgabe checken", 280, 496, 97, 25)
$Button11 = GUICtrlCreateButton("Lösung anzeigen", 208, 520, 169, 25)
$Button12 = GUICtrlCreateButton("Neue Zahl generieren", 0, 520, 193, 25)
$Label28 = GUICtrlCreateLabel("Lösung", 384, 528, 39, 17)
$Label29 = GUICtrlCreateLabel("© Copyright by TimmLanHD", 8, 552, 199, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
MsgBox(0,"Info","Generieren sie zuerst eine Zahl und klicken wenn es notwendig, ist auf Lösung anzeigen",3)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button8;3 zahl generieren
$randomzahl1 = randomzahl1() ;Zahl generieren
GUICtrlSetData($Label17, $randomzahl1)
$randomzahl1 = randomzahl1()
GUICtrlSetData($Label19, $randomzahl1)
Case $Button1;1zahl generieren
$randomzahl1 = randomzahl1() ;Zahl generieren
GUICtrlSetData($Label5, $randomzahl1)
$randomzahl1 = randomzahl1()
GUICtrlSetData($Label3, $randomzahl1)
Case $Button4;2 geschriebenes checken
If Not GUICtrlRead($Input2, GUICtrlRead($Label10) - GUICtrlRead($Label12)) Then
MsgBox(0, "Fehler", "Streng dein kopf mehr an ;-)")
EndIf
Case $Button5;2 zahl generieren
$randomzahl1 = randomzahl1() ;Zahl generieren
GUICtrlSetData($Label10, $randomzahl1)
$randomzahl1 = randomzahl1()
GUICtrlSetData($Label12, $randomzahl1)
Case $Button6;2 zusammenrechnen
GUICtrlSetData($Label14 , GUICtrlRead($Label10) - GUICtrlRead($Label12)) ;zusammenrechnen
Case $Button2;1 zusammenrechnen
GUICtrlSetData($Label7, GUICtrlRead($Label3) + GUICtrlRead($Label5)) ;zusammenrechnen
Case $Button3;1 geschriebenes checken
If Not GUICtrlRead($Input1, GUICtrlRead($Label3) + GUICtrlRead($Label5)) Then
MsgBox(0, "Fehler", "Streng dein kopf mehr an ;-)")
EndIf
Case $Button7;3 geschriebenes checken
If Not GUICtrlRead($Input3, GUICtrlRead($Label17) - GUICtrlRead($Label19)) Then
MsgBox(0, "Fehler", "Streng dein kopf mehr an ;-)")
EndIf
Case $Button9;3 zusammenrechnen
GUICtrlSetData($Label21, GUICtrlRead($Label17) * GUICtrlRead($Label19)) ;zusammenrechnen
Case $Button12;4 Zahl generieren
$randomzahl2 = randomzahl2() ;Zahl generieren
GUICtrlSetData($Label24, $randomzahl2)
$randomzahl2 = randomzahl2()
GUICtrlSetData($Label26, $randomzahl2)
Case $Button11;4 zusammenrechnen
GUICtrlSetData($Label28, GUICtrlRead($Label24) / GUICtrlRead($Label26)) ;zusammenrechnen
Case $Button10;3 geschriebenes checken
If Not GUICtrlRead($Input3, GUICtrlRead($Label24) - GUICtrlRead($Label26)) Then
MsgBox(0, "Fehler", "Streng dein kopf mehr an ;-)")
EndIf
EndSwitch
WEnd
Func randomzahl1()
Return Random(1, 100, 1)
EndFunc
Func randomzahl2()
Return Random(1, 20, 1)
EndFunc






