コード例 #1
0
def Traffic_Animation(space, l, time, lane, density):
    import Tkinter as tk
    import numpy as np

    cars = dict()

    n = int(density * l * lane)
    w = 1200 / l
    window = tk()
    canvas = Canvas(window, width=1200, height=lane * (w + 50))
    canvas.pack()

    for i in range(n):
        cars[i] = canvas.create_rectangle(w * space[i][0],
                                          20,
                                          w * space[i][0] + w,
                                          20 + w,
                                          fill="red",
                                          tag=i)

    for k in range(time):
        for t in range(w):
            for i in range(n):
                canvas.move(i, space[i][k], 0)
                canvas.after(20)
                canvas.update()

    window.mainloop()
コード例 #2
0
def Traffic_Animation(space,l,time,lane,density):
    import Tkinter as tk
    import numpy as np
    
    cars = dict()
    
    n = int(density*l*lane)
    w = 1200/l
    window = tk()
    canvas = Canvas(window, width = 1200, height = lane*(w+50))
    canvas.pack()
    
    for i in range(n):
        cars[i] = canvas.create_rectangle(w*space[i][0],20,w*space[i][0]+w,20+w,fill="red", tag=i)
        
    for k in range(time):
        for t in range(w):
            for i in range(n):
                canvas.move(i,space[i][k],0)
                canvas.after(20)
                canvas.update()

    
    window.mainloop()
コード例 #3
0
import tkinter as tk

if __name__ == '__main__':
    app = tk()
    app.title("LEDControl")
    app.geometry("500x600")
    Label(app, text="Hello window").pack()
    app.mainloop()
コード例 #4
0
import tkinter as tk
root = tk()
cwgt = Canvas(root)
cwgt.pack(expand=True, fill=BOTH)
image1 = PhotoImage(file="background1.png")
# keep a link to the image to stop the image being garbage collected
cwgt.img = image1
cwgt.create_image(0, 0, anchor=NW, image=image1)
b1 = Button(cwgt, text="Hello", bd=0)
cwgt.create_window(20, 20, window=b1, anchor=NW)
root.mainloop()
コード例 #5
0
    clientes_tab = Table(t3, title="Clientes Registrados", headers=clientes_headers)
    clientes_tab.pack()

    #cursor.execute("SELECT Clientes.Marca,Facebook,Instagram,Twitter,Correo,Web FROM Clientes")
    cursor = ((u"Marca A", u"Facebook A", u"Instagram A", u"Twitter A", u"*****@*****.**", u"www.aaa.com"),
              (u"Marca B", u"Facebook B", u"Instagram B", u"Twitter B", u"*****@*****.**", u"www.bbb.com")
              )

    for row in cursor:
        clientes_tab.add_row(row)

    #proyectos_headers = (u"Proyecto", u"Marca", u"Paquete")

    #proyectos_tab = Table(t3, title="Proyectos Registrados", headers=proyectos_headers)
    #proyectos_tab.pack()

    #cursor.execute("SELECT Proyectos.Proyecto,Marca,Paquete FROM Proyectos")
    #cursor = ((u"Proyecto A", u"Marca A", "Paquete A"),
     #         (u"Proyecto B", u"Marca B", u"Paquete A"
     #          )
     #         )

    #for row in cursor:
     #  proyectos_tab.add_row(row)




ventana  = tk()

ventana.mainloop()
コード例 #6
0
ファイル: gui.py プロジェクト: aoifemcdonagh/C4.5_ML-DM
def main():
    root = tk()
    root.geometry("250x150+300+300")
    app = GMMApplication(root)
    app.master.title('GMM GUI')
    app.mainloop()
コード例 #7
0
                      'default_response':
                      'I am sorry, but I do not understand.'
                  }])

conv = open('kkwagh.txt', 'r').read()
conv1 = conv.strip().split('\n')

chatbot.set_trainer(ChatterBotCorpusTrainer)
chatbot.train('chatterbot.corpus.english.greetings')

chatbot.set_trainer(ListTrainer)
chatbot.train(conv1)
list = ['bye', 'not responding well']
wrongip = ['not correct', 'wrong', 'what are you saying?', 'are you idiot']

master = tk()
master.minsize(300, 100)
master.geometry("320*100")


def callback():
    print("click!")


b = Button(master,
           text="Send",
           command=callback,
           height=50,
           width=150,
           compound=LEFT)
b.place(x=20, y=20)
コード例 #8
0
ファイル: cd.py プロジェクト: Mohit54/AMS
import tkinter as tk
from tkinter import tk

from tkcalendar import Calendar, DateEntry
top = tk()


def example1():
    def print_sel():
        print(cal.selection_get())

    top = tk.Toplevel(root)

    cal = Calendar(top,
                   font="Arial 14",
                   selectmode='day',
                   cursor="hand1",
                   year=2018,
                   month=2,
                   day=5)
    cal.pack(fill="both", expand=True)
    ttk.Button(top, text="ok", command=print_sel).pack()


def example2():
    top = tk.Toplevel(root)

    ttk.Label(top, text='Choose date').pack(padx=10, pady=10)

    cal = DateEntry(top,
                    width=12,
コード例 #9
0
import tk as tk
from tkinter import *
root = tk()
label1 = Label(root, text="Hello World")
label1.pack()
root.mainloop()


#frame
from tkinter import *
root = tk()
newframe = Frame(root)
newframe.pack()
otherframe = Frame(root)
otherframe.pack(slide=BOTTOM)
button1 = Button(newframe, text = "Click Here",fg="Red")
button2 = Button(otherframe, text = "Click Here", fg = "Blue")

button1.pack()
button2.pack()
root.mainloop()

#grid
from tkinter import *

root = tk()

label1 = Label(root, text="Firstname")
label2 = Label(root, text="Lastname")

entry1 = Entry(root)
コード例 #10
0
ファイル: main.py プロジェクト: IRIDIUM-SUB/Sys_Course_Design
from tkinter import *
from tk import *
'''
了解/proc文件的特点和使用方法
监控系统状态,显示系统部件的使用情况
用图形界面监控系统状态,包括系统基本信息、CPU和内存利用率、所有进程信息等(可自己补充、添加其他功能)
'''

if __name__ == "__main__":
    '''
    main entrance
    '''
    tkobj = tk()
    tkobj.root.mainloop()
コード例 #11
0
def getCsvFile(csv_file):
    if len(csv_file) == 0:
        tk().withdraw()
        return filedialog.askopenfilename(title='Choose a CSV File')
    else:
        return csv_file
コード例 #12
0
ファイル: q1.py プロジェクト: chauhanvishu/bbc
# -*- coding: utf-8 -*-
"""
Created on Sun Jul  1 23:52:48 2018

@author: aksha
"""

import tkinter as tk
m = tk()
label = tk.Label(m, text="Hello World")
label.pack()
コード例 #13
0
import tkinter as tk
import show

root = tk().Tk()
frame = tk.Frame(root)
frame.pack()

button = tk.Button(
    root,
    text="press it",
    command=lambda: execfile(
        "/home/aakankshakhatri/Facial-Expression-Detection-master(2)/show.py"))
button.pack()

root.mainloop()
コード例 #14
0
def main():
    root = tk()
    root.mainloop()
コード例 #15
0
#simple letter counter
import tkinter as tk

frameWindow = tk()
frameWindow.geometry("400x260+50+50")
frameWindow.title("simple letter counter")

message1 = tk.StringVar()
letter1 = tk.StringVar()


def printMessage():
    message = message1.get()
    letter = letter1.get()
    message = message.lower()
    letter = letter.lower()


    letterCount = message.count(letter)
    a = "your message have : "+str(letterCount)+" "+letter+"'s in it."
    labelFrameWindow = tk.Label(frameWindow, text=a, font=('arial',15), fg='black').place(x=10,y=10)
    labelTextField = tk.Label(frameWindow, text="Enter the letter you want to count", font=('ubuntu', 15),fg='black').place(x=10, y=80)
    textField1 = tk.Entry(frameWindow, font=('arial',15), textVariable=message1, bg='white', fg='black').place(x=10, y=40, height=40, width=340)
    textField2 = tk.Entry(frameWindow, font=('arial',15), textVariable=letter1, bg='white', fg='black').place(x=10, y=120, height=40, width=340)
    buttonCount = tk.Button(frameWindow, text="Check letter", command=printMessage, cursor="hand2", font=("Times new roman",30), fg='white', bg='black').place(x=10, y=170, height=40, width=380)

    # print("In this app, I will count the number of times that a specific letter occurs in a message.")
    # message = input("\nPlease enter a message: ")
    # letter = input("Which letter would you like to count the occurrences of?: ")

    frameWindow.mainloop()
コード例 #16
0
def _getFilePath(name, initialdir):
    tk().withdraw()
    return askopenfilename(title=name, initialdir=initialdir)
コード例 #17
0
# RETRIEVING STRING ANSWERS FROM USER
# The askquestion() function

import tkinter as tk
from tkinter import messagebox


def question():
    answer = messagebox.askquestion(
        "?", "I'm going to format your hard drive"
    )  # Return 'Yes' if user response is positive
    print(answer)  # Return 'No' if user response is negative
    # Both of these are STRINGS


window = tk()
window.title('Returning Strings')
button = tk.Button(window, text="What are your plans?", command=question)
button.pack()
window.mainloop()

####
# The showerror() function

import tkinter as tk
from tkinter import messagebox


def question():
    answer = messagebox.showerror(
        "!", "Your code does nothing!")  # Returns 'OK' string in every case
コード例 #18
0
def main():
    root = tk()
    windows1 = Window(root, 'Example', '300x300', 'Window 1 From class Window')