-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemp.py
68 lines (58 loc) · 1.9 KB
/
temp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 18 15:13:21 2017
@author: Ionut
"""
#============== CLASS TEST ====================================================
# myVar = 0
# def myFunc(param):
# myVar = 1
# return myVar
# # print(myVar)
# #def myFunc():
# # myVar = 1
# #myFunc(myVar)
# myVar = myFunc(myVar)
# print(myVar)
#==============================================================================
#=============== AREA CALC ====================================================
import tkinter as tk
import math
def areacalc(event):
numberB = float(inputNumber.get())
numberC = float(inputNumber1.get())
print(numberB, type(numberB))
print(numberC, type(numberC))
actualcalc = (numberB * numberC)
result.configure(text="Area of a rectangle is: " +str(actualcalc))
root = tk.Tk()
lbl = tk.Label(root, text="Input your length:").pack()
inputNumber = tk.Entry(root)
inputNumber.bind("<Return>", areacalc)
inputNumber.pack()
lbl1 = tk.Label(root, text="Input your width:").pack()
inputNumber1 = tk.Entry(root)
inputNumber1.bind("<Return>", areacalc)
inputNumber1.pack()
result = tk.Label(lbl)
result.pack()
root.mainloop()
#==============================================================================
#==============================================================================
# import tkinter.messagebox
# # does not work without explicit import
#
# # basic messagebox
# tkinter.messagebox.showinfo("WindTilte", message="this is some message")
#
# # question to answer yes/no
# answer = tkinter.messagebox.askquestion("Question 1", "what do anser")
# if answer == "yes":
# print("clicked yes")
#
# # another type of message
# ans2 = tkinter.messagebox.askyesnocancel('title', 'Triple question')
# print(ans2)
#
#
#==============================================================================