Jovian
⭐️
Sign In
In [1]:
import tkinter as tk
In [4]:
root=tk.Tk()
root.title("myfirstApp")
root.geometry("300x300")
frame=tk.Frame(root,width=300,height=300)
frame.pack(side="left")
label=tk.Label(frame,text="UserName")
label.pack()
label1=tk.Label(frame,text="Password")
label1.pack()
label2=tk.Label(frame,text="forget password")
label2.pack()
root.mainloop()
In [1]:
import tkinter as tk
from tkinter import ttk


root=tk.Tk()
root.title("mySecondApp")
root.geometry("1200x1000")

frame=tk.Frame(root,bg="blue",width=100,height=150)
frame.place(relx=0.2,rely=0.1,relheight=0.5,relwidth=0.5)

label=ttk.Label(frame,text="Name",width=20)
label.place(relx=0.1,rely=0.1)
entry=ttk.Entry(frame)
entry.place(relx=0.5,rely=0.1,relwidth=0.3)

label1=tk.Label(frame,text="Password",bg="cyan",width=20)
label1.place(relx=0.1,rely=0.3)
entry1=tk.Entry(frame)
entry1.place(relx=0.5,rely=0.3,relwidth=0.3)

label3=tk.Label(frame,text="Login Here!!",bg="red",fg="yellow",pady=4,width=50,)
label3.place(relx=-0.1,rely=0.0)
label3.config(font=("Vineta BT",10,"bold","italic"))

button=tk.Button(frame,text="Submit",activeforeground = "red",activebackground = "pink",pady=2,relief="raised")
button.place(relx=0.3,rely=0.4,relwidth=0.2)

button1=tk.Button(frame,text="Reset",activeforeground = "red",activebackground = "pink",pady=2,relief="raised")
button1.place(relx=0.5,rely=0.4,relwidth=0.2)

C = tk.Canvas(root, bg="blue", height=250, width=300)
coord = 10, 70, 240, 320
arc = C.create_arc(coord, start=0, extent=150, fill="red")
C.place(relx=0.3,rely=0.6)

var = tk.StringVar()
label4 = tk.Message( root, textvariable=var, relief="raised" )
var.set("This is a tkinter Platform!!")
label4.place(relx=0.6,rely=0.6)




root.mainloop()
In [80]:
from tkinter import *

root = Toplevel()

canv = Canvas(root, width=500, height=800, bg='white')
canv.place(relx=0.2, rely=0.1)

img = ImageTk.PhotoImage(file="DSC_0171.JPG") 
canv.create_image(12, 10, anchor=NW, image=img)

mainloop()
In [1]:
c = int(input(" Please Enter the Maximum Value : "))
d = 0

for i in range(1,c+1):
    if(i%2!=0):
        print(i)
        d=d+i
print(i)

Please Enter the Maximum Value : 5 1 3 5 5
In [1]:
#sum of odd and even position in a digit
num=int(input("enter a number="))
i=1
sum=0
summ=0
while num>0:
    rem=num%10
    num=int(num/10)
    if i%2==0:
        sum=sum+rem
    else:
        summ=summ+rem
    i=i+1
print("sum of odd position is=",sum)
print("sum of even position is =",summ)
z=abs(sum-summ)
print("difference is",z)

enter a number=5647 sum of odd position is= 9 sum of even position is = 13 difference is 4
In [45]:
#prime num
num=int(input("enter a number to check prime or not="))
a=0
for i in range(1,num+1):
    if(num%i==0):
        a=a+1
if a==2:
    print("prime num")
else:
    print("not a prime num")
enter a number to check prime or not=6 not a prime num
In [76]:
num=int(input('enter a number='))
a=0
b=1
sum=0
for i in range(1,s+1):
    if (i<=1):
        print(0)
    else:
        i=a+b
        a=b
        b=i    
    print(i)
enter a number=5 0 1 1 2 3 5
In [36]:
num=int(input("enter a num="))
for i in range (1,num+1):
    for j in range(1,num-i+1):
        print(end=' ')
enter a num=4
In [1]:
import jovian
In [ ]:
jovian.commit()
[jovian] Saving notebook..
In [ ]: