You are on page 1of 4

Python

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.

from tkinter import*


def cm3udl():

cm3=float(u1.get())
dl=cm3*1/100

rez1=Label(p,text=str(dl)+ ' dl')


rez1.place(x=330,y=60)

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()

p1.title('Sila toka rijeke')


p1.config(width=360, height=260)

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)

sila_mc=Label(p1,text='Sila motora čamca (N):')


sila_mc.place(x=35,y=110)

f2=Entry(p1,font=14)
f2.place(x=180,y=110,width=60)

g1=Button(p1,text='Nizvodno',command=nizvodno)

g1.place(x=50, y=170, width=100)


# right

g2=Button(p1,text='Uzvodno',command=uzvodno)
g2.place(x=200, y=170, width=100)

p1.mainloop()

You might also like