예제 #1
0
파일: war_gui.py 프로젝트: JacobAMason/War
    def __init__(self):
        self.main_window = tkinter.Tk()

        self.textBody = tkinter.Frame(self.main_window)
        self.buttons = tkinter.Frame(self.main_window)

        self.label1 = tkinter.Label(self.textBody, text="Let's play war!")
        self.entry_prompt1 = tkinter.Label(self.textBody, text="What's your name? ")
        self.nameObj = tkinter.StringVar()
        self.nameTemp = ""
        self.entry1 = tkinter.Entry(self.textBody, width=10, textvariable=self.nameTemp)
        self.nameObj.set(self.nameTemp)
        self.name = self.nameObj.get()
        self.label2 = tkinter(self.textBody, text=self.name)

        self.label1.pack(side="top")
        self.entry_prompt1.pack(side="left")
        self.entry1.pack(side="right")
        self.label2.pack(side="bottom")

        self.textBody.pack()

        self.button1 = tkinter.Button(self.buttons, text="Next", command=self.display_name)

        self.button1.pack(side="bottom")

        self.buttons.pack(side="bottom")
        tkinter.mainloop()  # this is like a spin
예제 #2
0
파일: war_gui.py 프로젝트: JacobAMason/War
    def __init__(self):
        self.main_window = tkinter.Tk()

        self.textBody = tkinter.Frame(self.main_window)
        self.buttons = tkinter.Frame(self.main_window)

        self.label1 = tkinter.Label(self.textBody, text="Let's play war!")
        self.entry_prompt1 = tkinter.Label(self.textBody,
                                           text="What's your name? ")
        self.nameObj = tkinter.StringVar()
        self.nameTemp = ""
        self.entry1 = tkinter.Entry(self.textBody,
                                    width=10,
                                    textvariable=self.nameTemp)
        self.nameObj.set(self.nameTemp)
        self.name = self.nameObj.get()
        self.label2 = tkinter(self.textBody, text=self.name)

        self.label1.pack(side="top")
        self.entry_prompt1.pack(side="left")
        self.entry1.pack(side="right")
        self.label2.pack(side="bottom")

        self.textBody.pack()

        self.button1 = tkinter.Button(self.buttons,
                                      text="Next",
                                      command=self.display_name)

        self.button1.pack(side="bottom")

        self.buttons.pack(side="bottom")
        tkinter.mainloop()  #this is like a spin
예제 #3
0
    def __init__(self):
        """initialize a new application manager by loading a list of apps from the file and by initializing tkinter"""
        self.character_choices = Main("ACTUALHACK3.py")
        self.root = tkinter()

        self.app_choices = ("mad_lib.py")
        self.app_choices = ("basicCalc.py")
        self.app_choices = ("calendar.py")
        self.app_choices = ("Periodic_table.py")
        self.app_choices = ("surprise.py")
        self.app_choices = ("meme_gen.py")
        self.app_choices = ("academy.py")
        self.app_choices = ("click_counter.py")
        self.app_choices = ("color_changer.py")
        self.app_choices = ("color_quiz.py")
        self.app_choices = ("disney_princess.py")
        self.app_choices = ("font_change.py")
        self.app_choices = ("hogwarts_house.py")
        self.app_choices = ("mean_median.py")
        self.app_choices = ("menu.py")
        self.app_choices = ("rand_num_gen.py")
        self.app_choices = ("wallet.py")
        self.app_choices = ("appChoices.py")
        self.app_choices = ("ZodiacQuiz.py")
예제 #4
0
import types
from tkinter import *
su = Tk()

su.geometry('300x300+200+300')
Label(root, text="Label a : x=0, y=0", bg="#FFFF00", fg="negro").place(x=0, y=0)
Label(root, text="Label b : x=50, y=40", bg="#3300CC", fg="blanco").place(x=40, y=30)
Label(root, text="Label c : x=75, y=80", bg="#FF0099", fg="negro").place(x=80, y=90)
Label(root, text="Label d : x=25, y=100", bg="#00FFFF", fg="blanco").place(x=30, y=120)
mainloop()

class tkinter:
	def __init__(self, func=None):
		self.name = 'Estrategia  0'
		if func is not None:
			self.ejecutar = types.MethodType(func, self)

	def ejecutar(self):
		print(self.name)

def ejecutar_reemplazo_1(self):
	print(self.name + 'de ejecutar 1')


if __name__ == '__main__':
	estrateg0 = tkinter()
	estrateg1 = tkinter(ejecutar_reemplazo_1)
	estrateg1.name = "Estrategia 1"
    estrateg0.ejecutar()
    estrateg1.ejecutar()
예제 #5
0
'''
[Homework]
Date: 2021-03-13
Project.  Full Color Charts
Description:
Save all color names into an external text file
Read the data (of color names) files
Display a full color chart
Calculate the execution time
Hints:
You may set MAX_ROWS or MAX_COLUMNS as you wish
All cells must be of equal width
Exception handling
Data file:
evaluate_3_project/full_color_chart/colors.txt
Required Tech:
tkinter (Label, grid layout)
flow control, arithmetic operation, file io, exception handling, date and time
Due date: by the end of next Friday

'''
"""
score
not actually do homework

"""

from tkinter import *
root = Tk()
root.geometry('+200+200')
예제 #6
0
class tkinter:
    def __init__(self, func=None):
        self.name = 'Strategy  0'
        if func is not None:
            self.execute = types.MethodType(func, self)

    def execute(self):
        print(self.name)


def execute_replacement1(self):
    print(self.name + 'from execute 1')


def execute_replacement2(self):
    print(self.name + 'from execute 2')


if __name__ == '__main__':
    strat0 = tkinter()

    strat1 = tkinter(execute_replacement1)
    strat1.name = 'Strategy Example 1'

    strat2 = tkinter(execute_replacement2)
    strat2.name = 'Strategy Example 2'

    strat0.execute()
    strat1.execute()
    strat2.execute()
"""
Date: 2021-03-14
Project.  Full Color Charts
Description:
Save all color names into an external text file
Read the data (of color names) files
Display a full color chart
Calculate the execution time
Hints:
You may set MAX_ROWS or MAX_COLUMNS as you wish
All cells must be of equal width
Exception handling
Data file:
evaluate_3_project/full_color_chart/colors.txt
Required Tech:
tkinter (Label, grid layout)
flow control, arithmetic operation, file io, exception handling, date and time
Due date: by the end of next Friday
"""

# import tkinter module
from tkinter import *
# datetime module
import datetime
import os

# root
root = Tk()
root.title("Python GUI")
예제 #8
0
from src.Programs.Section1 import Section1
from tkinter import *
window = tkinter()
sleep(1500)
예제 #9
0
        self.start_button.grid(column=0, row=2)

    def create_tk_output_label(self):

        self.your_label2 = Label(self.root, textvariable=self.time_variable)
        self.your_label2.grid(column=0, row=3)

    def tk_update_label(self):
        #grabs the variable from tkinter and sets it
        self.time_entry = self.feet_entry.get()

        #main for loop, also converts variable to integer and then makes it into minutes
        for i in reversed(range(int(self.feet_entry.get())*60)):

            #updates the variable for tkinter
            self.time_variable.set(time.strftime('%H:%M:%S', time.gmtime(i)))
            self.root.after(1000, self.root.update())

            #plays sound when timer is up.
            if i == 0:
                for i2 in range(10):
                    playsound('soundfiles/270405__littlerobotsoundfactory__pickup-gold-03.wav')


object1 = tkinter()

object1.create_tk_top_label()
object1.create_tk_userinput()
object1.create_tk_button()
object1.create_tk_output_label()
tkinter.root.mainloop()
예제 #10
0
    canvashoofd.create_window(450, 350, window=entrydatabase)

    # aanmaken invoer host
    labelhost = tk.Label(text='Host:',
                         background='white',
                         font=('Courier', 20))
    canvashoofd.create_window(200, 425, window=labelhost)
    entryhost = tk.Entry(root, font=('Courier', 15))
    canvashoofd.create_window(450, 425, window=entryhost)

    # invoegen afbeelding hsleiden
    imgHSL = PhotoImage(file='Afbeeldingen/hsleiden.png')
    imgHSL = imgHSL.subsample(2)
    labelimgHSL = tk.Label(root, image=imgHSL, borderwidth=0)
    canvashoofd.create_window(700, 525, window=labelimgHSL)

    # aanmake button die de functie overzetten aanroept
    button = tk.Button(root,
                       text='Overzetten',
                       command=overzetten,
                       bg='sky blue',
                       bd=2.5,
                       font=('Courier', 15))
    canvashoofd.create_window(400, 500, window=button)

    root.mainloop()


if __name__ == '__main__':
    tkinter()
예제 #11
0
    elif psng == 4:
        target['x_pos'] = target['x_pos'] - randint(0, spd)
        target['y_pos'] = target['y_pos'] - randint(0, spd)

    else:
        print(':(')

    if target['x_pos'] >= boundary:
        target['x_pos'] = boundary

    if target['y_pos'] >= boundary:
        target['y_pos'] = boundary

    tarxy = (target['x_pos'], target['y_pos'])

    root = tkinter
    for r in range(boundary + 1):
        for c in range(boundary + 1):
            coordinate = (r, c)
            if tarxy == coordinate:
                tkinter(root, text='%s,%s,%s' (r, c, 'yaaay'),
                        borderwidth=5).grid(row=r, column=c)
                print(coordinate)

            else:
                tkinter(root, text='%s,%s' (r, c),
                        borderwidth=5).grid(row=r, column=c)

print(tarxy, 'qwerty')
root.mainloop()
예제 #12
0
'''Пакет tkinter содержит несколько модулей, предоставляющих доступ к уже готовым
диалоговым окнам. Это окна различных сообщений, выбора по принципу "да-нет", открытия
и сохранения файлов и др. В этом уроке рассмотрим примеры окон из модулей messagebox
и filedialog пакета tkinter.

Модули пакета необходимо импортировать отдельно. То есть вы импортируете содержимое
tkinter (например, from tkinter import *) и отдельно входящий в состав пакета tkinter
модуль:
import tkinter.messagebox → tkinter.messagebox.askyesno()
from tkinter.messagebox import * → askyesno()
from tkinter import messagebox → messagebox.askyesno()
from tkinter import messagebox as mb (вместо mb может быть любой идентификатор) → mb.askyesno()'''
'''Модуль messagebox – стандартные диалоговые окна
Окно выбора "да" или "нет" – askyesno():'''

from tkinter import *
from tkinter import messagebox as mb


def check():
    answer = mb.askyesno(title='Вопрос', message='Перенести данные?')
    if answer == True:
        s = entry.get()
        entry.delete(0, END)
        label['text'] = s


root = Tk()
entry = Entry()
entry.pack(pady=10)
        for t in lista_tiros:
            t.atualizar()
            t.desenhar()
            t.crash3()


        #if Jogador.Score in etapas:
            #if etapas[Jogador.Score][1] == False:
                #velocidade_fundo += etapas[Jogador.Score][0]
                #etapas[Jogador.Score][1] = True
                #print('Score: %d  Velocidade: %d '%(Jogador.Score, velocidade_fundo))

        
        #pygame.mixer.Sound.stop(faustao)

        pygame.display.update()
        framespersecond.tick(fps)


tkinter()
intro() 
controle()
rostos()
music_select()
car_select()
Score_Final()
restart()        
loop_jogo()
pygame.quit()
quit()