Professional Documents
Culture Documents
Informatika
Informatika
1.
from tkinter import*
def kmhums():
kmh=float(u1.get())
ms=kmh*1000/3600
rez1=Label(p,text=str(ms)+ ' m/s')
rez1.place(x=330,y=60)
def msukmh():
ms=float(u2.get())
kmh=ms*3600/1000
rez2=Label(p,text=str(kmh)+' km/h')
rez2.place(x=330,y=100)
p=Tk()
p.config(width=500,height=180)
t=Label(p,text='Pretvorba složenijih mjernih jedinica brzine')
t.place(x=50,y=20)
t1=Label(p,text='Unesi km/h:')
t1.place(x=30,y=60)
u1=Entry(p)
u1.place(x=110,y=60,width=80)
g1=Button(p,text='Pretvori u m/s',command=kmhums)
g1.place(x=200,y=59,width=120)
t2=Label(p,text='Unesi m/s:')
t2.place(x=30,y=100)
u2=Entry(p)
u2.place(x=110,y=100,width=80)
g2=Button(p,text='Pretvori u km/h',command=msukmh)
g2.place(x=200,y=99,width=120)
p.mainloop()
2.
cm3=float(u1.get())
dl=cm3*1/100
def m3uhl():
m3=float(u2.get())
hl=m3*10/1
rez2=Label(p,text=str(hl)+' hl')
rez2.place(x=330,y=100)
def mlum3():
ml=float(u3.get())
m3=ml*1/1000000
rez3=Label(p,text=str(m3)+' m3')
rez3.place(x=330,y=140)
p=Tk()
p.config(width=500,height=180)
t=Label(p,text='Pretvorba složenijih mjernih jedinica volumena')
t.place(x=50,y=20)
t1=Label(p,text='Unesi cm3:')
t1.place(x=30,y=60)
u1=Entry(p)
u1.place(x=110,y=60,width=80)
g1=Button(p,text='Pretvori u dl',command=cm3udl)
g1.place(x=200,y=59,width=120)
t2=Label(p,text='Unesi m3:')
t2.place(x=30,y=100)
u2=Entry(p)
u2.place(x=110,y=100,width=80)
g2=Button(p,text='Pretvori u hl',command=m3uhl)
g2.place(x=200,y=99,width=120)
t3=Label(p,text='Unesi ml:')
t3.place(x=30,y=140)
u3=Entry(p)
u3.place(x=110,y=140,width=80)
g3=Button(p,text='Pretvori u m3',command=mlum3)
g3.place(x=200,y=139,width=120)
p.mainloop()
3.
from tkinter import*
def nizvodno():
fr=int(f1.get())+ int(f2.get())
f=Label(p1,text=(fr,'N'),font=14)
f.place(x=80,y=210)
def uzvodno():
fr=int(f2.get())- int(f1.get())
f=Label(p1,text=(fr,'N'),font=14)
f.place(x=225,y=210)
p1=Tk()
naslov=Label(p1,text='Sila na čamcu',font=14)
naslov.place(x=120,y=10)
# left
sila_tr=Label(p1,text='Sila toka rijeke (N):')
sila_tr.place(x=60,y=70)
f1=Entry(p1,font=14)
f1.place(x=180,y=70,width=60)
f2=Entry(p1,font=14)
f2.place(x=180,y=110,width=60)
g1=Button(p1,text='Nizvodno',command=nizvodno)
g2=Button(p1,text='Uzvodno',command=uzvodno)
g2.place(x=200, y=170, width=100)
p1.mainloop()