Esempio n. 1
0
    def __init__(self):
        self.main_window = tkinter.Tk()
        #create 2 frames
        self.top_frame = tkinter.Frame(self.main_window)
        self.bottom_frame = tkinter.Frame(self.main_window)
        # label widgets
        self.label1 = tkinter.label(self.top_frame, text = 'Eric Chedgy')
        self.label2 = tkinter.label(self.top_frame, text = 'Instructional Design')
        # adding the labels to the top frame
        self.label1.pack(side='Top')
        self.label2.pack(side='Top')

        self.label3 = tkinter.label(self.bottom_frame, text = 'Programming logic')
        self.label4 = tkinter.label(self.bottom_frame, text = 'Graphic design')
        self.label5 = tkinter.label(self.bottom_frame, text = 'Comp Lit')

        self.label3.pack(side='Left')
        self.label4.pack(side='Left')
        self.label5.pack(side='Left')

        # pack frames
        self.top_frame.pack(side='left')
        self.bottom_frame.pack(side='left')

        tkinter.mainloop()
def main(args):
    root = tk.Tk()
    root.geometry("170x200+30+30")

    l1 = tk.label(root, text="texo superior", bg="red",
                  fg="white").place(x=30, y=10, width=120, height=25)
    l2 = tk.label(root, text="texo intermediario", bg="yellow",
                  fg="black").place(x=10, y=100, width=150, height=25)
    l3 = tk.label(root, text="texo inferior", bg="green",
                  fg="white").place(x=20, y=170, width=170, height=25)
    root.mainloop()
    return 0
Esempio n. 3
0
    def __init__(self):
        # Create the Main Window
        self.main_window = tkinter.Tk()
	# Create two frames to group widgets
        self.top_frame = tkinter.Frame(self.main_window)
	
        self.bottom_frame = tkinter .Frame(self.main_window)
	# Create the widgets for the top frame
        self.prompt_label = tkinter.label(self.top_frame, \
                                          text='What Year are you looking for the winner of?')
        self.year_entry = tkinter.Entry(self.top_frame, \
                                        width=10)
						
	#Pack the top frame's widgets
        self.prompt_label.pack(side='left')
        self.year_entry.pack(side='left')
        # Create a button widget for the bottom frame
        self.search_button = tkinter.Button(self.bottom_frame, \
                                            text='Search', \
                                            command=self.search)
        self.quit_button = tkinter.Button(self.bottom_frame, \
                                          text='Quit', \
                                          command=self.main_window.destory)
        # Pack the Buttons
        self.search_button.pack(sie='left')
        self.quit_button.pack(side='left')
        # Pack the frames
        self.top_frame.pack()
        self.bottom_frame.pack()
        # Enter the tkinter main loop
        tkinter.mainloop()
Esempio n. 4
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        label = tk.label(self, text="Graph Page", font=LARGE_FONT)
        label.pack(pady=10, padx=10)

        f = Figure(figsize=(5, 5), dpi=100)
        a = f.add_subplot(111)
Esempio n. 5
0
def addApp():
    for widget in frame.winfo_children():
        widget = destroy()
    filename = filedialog.askopenfilename(initialdir="/",
                                          title="select file",
                                          filetypes=(("executables", ".exe"),
                                                     ("all files", """.""")))
    apps.append(filename)
    print(filename)
    for app in apps:
        label = tk.label(frame, text=app, bg="gray")
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        label = tk.label(self,
                         text="This is the start page",
                         font=controller.title_font)
        label.pack(side="top", fill="x", pady=10)

        button = tk.Button(self,
                           text="Go to Page One",
                           command=lambda: controller.show_frame("StartPage"))
        button.pack()
Esempio n. 7
0
    def __init__(self):
        #Create the  main window widget

        self.main_window = tkinter.Tk()

        #create a two label widgets
        self.label1 = tkinter.label (self.main_window, \
                                     text = 'Hello World!')
        self.label2 = tkinter.label (self.main_window, \
                                     text = 'This is my GUI program')

        #Call both label widgets pack method

        self.label1.pack(side='left')
        self.label2.pack(side='left')

        #Enter the tkinter main loop
        tkinter.mainloop()

        #create an instance of the MyGUI class
        my_gui = MyGUI()
import tkinter as tk
from tkinter import *
#Main Code:
root = tk.Tk()
#Building widgets goes before mainloop.

title = tk.Label(root, text="Traffic Tracker", font=("Arial", 30))
title.config(fg="blue", bg="white")
title = tk.label(root, width=50, height=5)
title.pack(fill=tk.BOTH)
#builds your main wind
#Widget/Element is an element in a GUI
#Button, Textbox, Input box, Slider, drop down,
#Image,
#Step 1: Construct the widget.
btn1 = tk.Button(root, width=20, height=3)
#Step 2: Configure the widget.
btn1.config(text="Fast")
#Step 3: Place the widget - pack(), grid(),
btn1.pack()

btn2 = tk.Button(root, text="Slow", command=onclick, width=15, height=3)

btn2.config()
btn2.pack()

root.mainloop()
print("End Program")
Esempio n. 9
0
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 13 09:41:18 2016

@author: SRINIVAS
"""

import tkinter as tk
root = tk.Tk()
for r in range(4):
    for c in range(4):
        tk.label(root, text='R%s/C%s'%(r,c),
            borderwidth=1 ).grid(row=r,column=c)
root.mainloop(  )
Esempio n. 10
0
roll5 = tk.PhotoImage(file="*****@*****.**")

roll6 = tk.PhotoImage(file="*****@*****.**")

# Button

button_photo = ImageTk.PhotoImage(file="*****@*****.**")

button = tk.Button(width="150", height="150", image=button_photo)

button.bind("<button-1>", roll)

button.pack(side=" top", pady=50)

answer = tk.label(image="dice1")







answer2 = tk.label(image="dice1")

answer.pack()

answer.place(x=100, y=400)

answer2.pack()
Esempio n. 11
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 11 21:01:53 2020

@author: taufiq
"""

import tkinter

main_window = tkinter.Tk()

label = tkinter.label(main_window)

main_window.mainloop()
Esempio n. 12
0
				hunger -= 20 

def isAlive():
	global hunger

	if hunger <= 0:
		startLabel.config(text="Game Over")
		return False
	else:
		return True 

root = tkinter.Tk()
root.title('Alive')
root.geometry("500x300")

startLabel = tkinter.label(root, text="press start")














Esempio n. 13
0
def translation():
    word = entry.get()
    translator = Translator(service_urls = ['translate.google.com '])
    translation1 = translator.translate(word,dest ='ru')
    labe1 = tk.label(win, text=f"Translated in russian : {translation1.text}",bg = "yellow")
    label1.grid(row =2, column = 0)
Esempio n. 14
0
    "PYTHON", "SALESFORCE", "JAVA", "C#", "JAVASCRIPT", "GO", "R", "PHP",
    "HTML", "COBOL"
]
linguagem = input("Informe a linguagem de programação: ")
if linguagem.upper() in linguagens:
    print(f"{linguagem.upper()} está na lista! ")
else:
    print(f"{linguagem.upper()} não está na lista! ")

####################################################################################
#Relogio Digital

import tkinter as tk
from time import strftime as time

rel = tk.label(text=time("%H:%M:%S"), font="Helvetica 120 bold")
rel.pack()


def tictac():
    now = time("%H:%M:%S")
    if rel['text'] != now:
        rel['text'] = now
        rel.after(100, tictac)


tictac()
rel.mainloop()

####################################################################################
# Par ou Impar
Esempio n. 15
0
import tkinter as tk

root = tk.Tk()

tk.label(root, text="bar do ze atomaick").pack()
tk.button()

root.mainloop()

Esempio n. 16
0
canvas = tk.Canvas(root, height=500, width=500, bg="gray")
canvas.pack()

frame = tk.Frame(root, bg="white")
frame.place(relwidth=0.8, relheight=0.8, relx=0.1, rely=0.1)

openFile = tk.Button(root,
                     text="Open File",
                     padx=20,
                     pady=8,
                     fg="white",
                     bg="white",
                     command=addApp)
openFile.pack()
runApps = tk.Button(root,
                    text="Run Apps",
                    padx=10,
                    pady=5,
                    fg="white",
                    bg="white")
runApps.pack()

for app in apps:
    label = tk.label(frame, text=app)
    label.pack()

root.mainloop()
with open("save.txt", "w") as f:
    for app in apps:
        f.write(app + ",")
Esempio n. 17
0
import tkinter

root = tkinter.Tk()
f = tkinter.frame(root)
f.pack()
l = tkinter.label(f, text='hello world')
l.pack()
b = tkinter.button(f, text='quit', command=root.destroy())
b.pack()
Esempio n. 18
0
import tkinter as tk

root = tk.Tk()
root.geometry("400x300")

user_label = tk.label(root, text="useenaame")
user_button = tk.Button
user_label.pack()

root.mainloop()
Esempio n. 19
0
    def calculate():
        next_num = text.get()
        text.delete(0, tk.END)
        if label == 'add':
            text.insert(0, first_num + int(next_num))
        elif label == 'multiply':
            text.insert(0, first_num * int(next_num))
        elif label == 'divide':
            text.insert(0, first_num / int(next_num))
        elif label == 'subtract':
            text.insert(0, first_num - int(next_num))
        else:
            pass

        number1 = tk.Button(ob,
                            height=2,
                            width=25,
                            borderwidth=2,
                            command=lambda: on_click(1))
        number1.grid(row=1, column=0, columnspan=1)
        tk.label(ob, text="1").grid(row=1, column=0)

        number2 = tk.Button(ob,
                            height=2,
                            width=25,
                            borderwidth=2,
                            command=lambda: on_click(2))
        number2.grid(row=1, column=1, columnspan=1)
        tk.label(ob, text="2").grid(row=1, column=1)

        number3 = tk.Button(ob,
                            height=2,
                            width=25,
                            borderwidth=2,
                            command=lambda: on_click(3))
        number3.grid(row=1, column=2, columnspan=1)
        tk.label(ob, text="3").grid(row=1, column=2)

        number4 = tk.Button(ob,
                            height=2,
                            width=25,
                            borderwidth=2,
                            command=addition)
        number4.grid(row=1, column=3, columnspan=1)
        tk.label(ob, text="+").grid(row=1, column=3)

        number5 = tk.Button(ob,
                            height=2,
                            width=25,
                            borderwidth=2,
                            command=lambda: on_click(4))
        number5.grid(row=2, column=0, columnspan=1)
        tk.label(ob, text="4").grid(row=2, column=0)

        number6 = tk.Button(ob,
                            height=2,
                            width=25,
                            borderwidth=2,
                            command=lambda: on_click(5))
        number6.grid(row=2, column=1, columnspan=1)
        tk.label(ob, text="5").grid(row=2, column=1)

        number7 = tk.Button(ob,
                            height=2,
                            width=25,
                            borderwidth=2,
                            command=lambda: on_click(6))
        number7.grid(row=2, column=2, columnspan=1)
        tk.label(ob, text="6").grid(row=2, column=2)

        number8 = tk.Button(ob,
                            height=2,
                            width=25,
                            borderwidth=2,
                            command=subtract)
        number8.grid(row=2, column=3, columnspan=1)
        tk.label(ob, text="-").grid(row=2, column=3)

        number9 = tk.Button(ob,
                            height=2,
                            width=25,
                            borderwidth=2,
                            command=lambda: on_click(7))
        number9.grid(row=3, column=0, columnspan=1)
        tk.label(ob, text="7").grid(row=3, column=0)

        number10 = tk.Button(ob,
                             height=2,
                             width=25,
                             borderwidth=2,
                             command=lambda: on_click(8))
        number10.grid(row=3, column=1, columnspan=1)
        tk.label(ob, text="8").grid(row=3, column=1)

        number11 = tk.Button(ob,
                             height=2,
                             width=25,
                             borderwidth=2,
                             command=lambda: on_click(9))
        number11.grid(row=3, column=2, columnspan=1)
        tk.label(ob, text="9").grid(row=3, column=2)

        number12 = tk.Button(ob,
                             height=2,
                             width=25,
                             borderwidth=2,
                             command=multiplication)
        number12.grid(row=3, column=3, columnspan=1)
        tk.label(ob, text="*").grid(row=3, column=3)

        number13 = tk.Button(ob,
                             height=2,
                             width=25,
                             borderwidth=2,
                             command=lambda: on_click(0))
        number13.grid(row=4, column=0, columnspan=1)
        tk.label(ob, text="0").grid(row=4, column=0)

        number14 = tk.Button(ob,
                             height=2,
                             width=25,
                             borderwidth=2,
                             command=division)
        number14.grid(row=4, column=1, columnspan=1)
        tk.label(ob, text="/").grid(row=4, column=1)

        number15 = tk.Button(ob,
                             height=2,
                             width=25,
                             borderwidth=2,
                             command=calculate)
        number15.grid(row=4, column=2, columnspan=1)
        tk.label(ob, text="=").grid(row=4, column=2)

        number16 = tk.Button(ob,
                             height=2,
                             width=25,
                             borderwidth=2,
                             command=lambda: text.delete(0, tk.END))
        number16.grid(row=4, column=3, columnspan=1)
        tk.label(ob, text="Clear").grid(row=4, column=3)

        ob.mainloop()
Esempio n. 20
0
m = tkinter.Tk()


def hello():
    messagebox.showinfo(
        "HELLO,your dats is here",
        stdid.get() + "\n",
        stdname.get() + "\n",
        stdaddress.get() + "\n",
    )


l1 = tkinter.label(m,
                   text="Student- ID",
                   bg="yellow",
                   fg="red",
                   font=("Arial", 16)).grid(row=0, column=0, paddy=5)
l2 = tkinter.label(m,
                   text="Student- NAME",
                   bg="yellow",
                   fg="red",
                   font=("Arial", 16)).grid(row=1, column=0, paddy=5)
l3 = tkinter.label(m,
                   text="Student- ADDRESS",
                   bg="yellow",
                   fg="red",
                   font=("Arial", 16)).grid(row=2, column=0, paddy=5)
l4 = tkinter.label(m, text="GENDER", bg="yellow", fg="red",
                   font=("Arial", 16)).grid(row=3, column=0, paddy=5)
img = tkinter.PhotoImage(file=r"path of file.png")
Esempio n. 21
0
import tkinter as tk

window = tk.Tk()
greeting = tk.Label(text="Tkinter Starting Point")
greeting.pack(
)  # makes window as small as possible while including whatever was added

label = tk.label(
    text="Hi",
    foreground="white",  # can use fg instead
    background="#34A2FE",  # bg
    width=10,
    height=10)

window.mainloop()

# Widget Classes:
# Label - Widget used to display text on screen
# Button - Can contain text and can perform action when clicked
# Entry - Allows a single line of entered text
# Text - Entry of multiple lines
# Frame - Rectangular region that groups related widgets or provides padding between widgets
Esempio n. 22
0
def blocks(row, column, c):
	block = tk.label(frame_2, relwidth=0.25, relheight=0.20)
	block.grid(row=row, column=column)
	label['text'] = pesquisa[]
Esempio n. 23
0
"""tkinter=package
name=root


"""
import pygame
import label
import tkinter
from tkinter import ttk
import tkinter as tk

root = tkinter.Tk()
root.title("yar")
root.mainloop()
root = tk.Tk
"""

"""
tkinter.label(root, text='enter your name')
Esempio n. 24
0
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 12 14:25:50 2020

@author: ryanl
"""

import tkinter as tk
window = tk.Tk()
window.title("tk1")
def clickMe():
     tkinter.messagebox.showinfo(title,message="點珊小") 
label  = tk.label(window,text=="按我",bg="AEFDFF",FG"12345")
window.geometry("300x300")
label = tk.Label(window,text="my gui")
label.pack()
entry=tk.entry(window,width=21)
entry.pack()

button = tk.Button(window,text="按我",command = clickme)
button.pack()
window.mainloop()
Esempio n. 25
0
import tkinter as tk

#create the main window
root = tk.Tk()
root.title("Hello tkinter")

#create label
label = tk.label(root, text="Hello, World")

#lay out label
label.pack()

#run forever
root.mainloop()
Esempio n. 26
0
import tkinter as tk
from googletrans import translator

win = tk.Tk()
win.title('Translator')
win.geometry('200*70')

#Function

def translation():
    word = entry.get()
    translator = Translator(service_urls = ['translate.google.com '])
    translation1 = translator.translate(word,dest ='ru')
    labe1 = tk.label(win, text=f"Translated in russian : {translation1.text}",bg = "yellow")
    label1.grid(row =2, column = 0)

label = tk.label(win, text = 'Enter word : ')
label.grid(row = 0, column = 0, sticky = 'W')

entry = tk.Entry(win)
entry.grid(row = 0, column = 0)
button = tk.Button(win, text = "Translate: ", command = translation)
button.grid(row = 1, column = 2)

win.mainloop()
Esempio n. 27
0
    def setupui(self):
        #Left menu bar
        left_f = tk.Frame(self,
                          height=self.framedispheight,
                          width=self.leftframewidth)
        left_f.pack(side=tk.LEFT)
        #Names and positions of various function buttons
        btnopen = tk.Button(left_f,
                            text="open image",
                            command=self.openanddisplayimage)
        btnopen.place(y=25, x=30, width=300, height=self.btnheight)

        btntrans = tk.Button(left_f,
                             text="process image",
                             command=self.ontransrawimagebtnclicked)

        btntrans.place(y=85, x=30, width=300, height=self.btnheight)
        l_selrect = tk.Label(left_f, text="mouse selected")
        l_selrect.place(x=0,
                        y=165,
                        width=self.leftframewidth,
                        height=self.labeltextheight)
        "" "List" ""
        self.l_box = tk.Listbox(left_f)  #create two list components
        self.l_box.place(x=0,
                         y=165 + self.labeltextheight,
                         width=self.leftframewidth,
                         height=270)
        self.l_box.bind('<listboxselect>', self.onrectlistboxselect)
        self.drawlistbox()
        #Delete selected
        btndel = tk.button(left_f,
                           text="delete selected",
                           command=self.deleteselecteditemfromlistbox)
        btndel.place(y=460, x=30, width=300, height=self.btnheight)

        btnsave = tk.button(left_f,
                            text="Save result",
                            command=self.onsavetransrawimagebtnclicked)

        btnsave.place(y=550, x=30, width=300, height=self.btnheight)
        #Right image display bar
        right_f = tk.frame(self,
                           height=self.framedispheight,
                           width=self.imagedispwidth)
        right_f.pack(side=tk.right)
        l_rawt = tk.label(right_f, text="raw image")
        l_rawt.place(x=0,
                     y=0,
                     width=self.imagedispwidth,
                     height=self.labeltextheight)
        self.image_l_raw = tk.label(right_f, relief="ridge")
        self.image_l_raw.place(x=0,
                               y=self.labeltextheight,
                               width=self.imagedispwidth,
                               height=self.imagedispheight)
        self.image_l_raw.bind("<button-1>", self.rawimagelabelclicked)
        l_transt = tk.label(right_f, text="Processed image")
        l_transt.place(x=0,
                       y=self.labeltextheight + self.imagedispheight,
                       width=self.imagedispwidth,
                       height=self.labeltextheight)
        self.image_l_trans = tk.label(right_f, relief="ridge")
        self.image_l_trans.place(x=0,
                                 y=self.labeltextheight +
                                 self.imagedispheight + self.labeltextheight,
                                 width=self.imagedispwidth,
                                 height=self.imagedispheight)
Esempio n. 28
0
mainwindow.title('Music BD Browser')
mainwindow.geometry('1824x763')

mainwindow.columnconfigure(0, weight=2)
mainwindow.columnconfigure(1, weight=2)
mainwindow.columnconfigure(2, weight=2)
mainwindow.columnconfigure(3, weight=1)

mainwindow.rowconfigure(0, weight=1)
mainwindow.rowconfigure(1, weight=5)
mainwindow.rowconfigure(2, weight=5)
mainwindow.rowconfigure(3, weight=1)

#labels

tkinter.label(mainwindow, text='Artist').grid(row=0, column=0)
tkinter.label(mainwindow, text='Albums').grid(row=0, column=1)
tkinter.label(mainwindow, text='Songs').grid(row=0, column=2)

# artist listbox

artistlist = scrollbox(mainwindow)
artistlist.grid(row=1, column=0, sticky='nsew', rowspan=2, padx=(30,0))
artistlist.config(border=2, relief='sunken')

for artist in conn.execute("SELECT artisi.name FROM artists ORDER BY artsist.name"):
    artistlist.insert(tkinter.END, artist(0))

artistlist.bind('<<ListboxSelect>>', get_album)

Esempio n. 29
0
import tkinter

main_window = tkinter.Tk()

label1 = tkinter.label(main_window, text="label 1")

#method positioning
label1.pack()

#method menampilkan GUI
main_window.mainloop()
import tkinter as tk

root = tk.Tk()

lab = tk.label(root, text="Enter a number:")

lab.grid(root, row=0, column=0)

ent = tk.Entry(root)
ent.grid(row=1, column=0)

btn = tk.button(root, text="Press Me")
btn.grid(row=2, column=0)

output = tk.Text(root)
output.configure(state="disable")
output.grid(row=0, column=1, rowspan=1)

root.mainloop()