def get_barcodes(parent, commands): global scan_in_barcode scan_in_barcode = TextBox(parent, width=22, grid=[1, 2, 2, 1], align='left') scan_in_barcode.text_color = display_config.text_color scan_in_barcode.font = display_config.text_font scan_in_barcode.text_size = display_config.text_size scan_in_barcode.when_key_pressed = commands[0] global scan_out_barcode scan_out_barcode = TextBox(parent, width=22, grid=[1, 2, 2, 1], align='left') scan_out_barcode.text_color = display_config.text_color scan_out_barcode.font = display_config.text_font scan_out_barcode.text_size = display_config.text_size scan_out_barcode.when_key_pressed = commands[1] global look_up_barcode look_up_barcode = TextBox(parent, width=22, grid=[1, 2, 2, 1], align='left') look_up_barcode.text_color = display_config.text_color look_up_barcode.font = display_config.text_font look_up_barcode.text_size = display_config.text_size look_up_barcode.when_key_pressed = commands[2]
def spin_up_editable_texts(parent, command): texts = [] global item_name_text item_name_text = Text(parent, width='fill', color=display_config.text_color, font=display_config.text_font, size=display_config.text_size, grid=[2, 3], align='left') global item_quantity_text item_quantity_text = Text(parent, width='fill', color=display_config.text_color, font=display_config.text_font, size=display_config.text_size, grid=[2, 4], align='left') global item_size_text item_size_text = Text(parent, width='fill', color=display_config.text_color, font=display_config.text_font, size=display_config.text_size, grid=[2, 5], align='left') global item_name_text_box item_name_text_box = TextBox(parent, width=45, grid=[2, 3, 2, 1], align='left') item_name_text_box.text_color = display_config.text_color item_name_text_box.font = display_config.text_font item_name_text_box.text_size = display_config.text_size item_name_text_box.when_clicked = command global item_quantity_text_box item_quantity_text_box = TextBox(parent, width=10, grid=[2, 4], align='left') item_quantity_text_box.text_color = display_config.text_color item_quantity_text_box.font = display_config.text_font item_quantity_text_box.text_size = display_config.text_size item_quantity_text_box.when_clicked = command global item_size_text_box item_size_text_box = TextBox(parent, width=10, grid=[2, 5], align='left') item_size_text_box.text_color = display_config.text_color item_size_text_box.font = display_config.text_font item_size_text_box.text_size = display_config.text_size item_size_text_box.when_clicked = command
def StartOnePlayer(): global onePlayerWindow global drawButtonOnePlayer global cardImagesOnePlayer global guessContainerOnePlayer global guessCheckButtonOnePlayer global guessTextBoxOnePlayer global correctOnePlayer global errorTextOnePlayer onePlayerWindow = Window(app, title="One Player Game", layout="grid") onePlayerWindow.width = 320; onePlayerWindow.height = 560; onePlayerWindow.bg = "Lime" drawButtonOnePlayer = PushButton(onePlayerWindow, text="Draw!", grid=[0, 0], align="top", command=ButtonSwapOnePlayer) drawButtonOnePlayer.width = 20; drawButtonOnePlayer.height = 5; drawButtonOnePlayer.bg = "White" cardImagesOnePlayer = Box(onePlayerWindow, layout="grid", grid=[0, 1], align="top", border=True) cardImagesOnePlayer.set_border(10, "Lime") guessContainerOnePlayer = Box(onePlayerWindow, layout="grid", grid=[0, 2], align="top", border=True) guessContainerOnePlayer.set_border(10, "Lime") guessTextBoxOnePlayer = TextBox(guessContainerOnePlayer, grid=[0, 0], align="top") guessTextBoxOnePlayer.text_size = 20; guessTextBoxOnePlayer.bg = "White"; guessTextBoxOnePlayer.disable(); guessCheckButtonOnePlayer = PushButton(guessContainerOnePlayer, text="Check!", grid=[0, 1], align="top", command=CheckValuesOnePlayer) guessCheckButtonOnePlayer.width = 20; guessCheckButtonOnePlayer.height = 5; guessCheckButtonOnePlayer.bg = "White"; guessCheckButtonOnePlayer.disable(); pointsTextOnePlayer = Text(guessContainerOnePlayer, text="Score: ", grid=[0, 2], align="top") correctOnePlayer = Text(onePlayerWindow, text="", grid=[0, 3]) errorTextOnePlayer = Text(onePlayerWindow, text="Please enter a number!", grid=[0, 4]) errorTextOnePlayer.hide()
def init_widgets(): global app, Weather_drawing, Add_textbox, To_do_list_Title, Addbutton, delbutton, Clearbutton, Citybutton To_do_list_Title = Text(app, "To-do List:", size=20, color="light gray", grid=[0,2,1,1],align="left") create_list() Add_textbox=TextBox(app,grid=[0,4,1,1],width=50, align="left") Add_textbox.text_size=12 Add_textbox.text_color="Black" Add_textbox.font="Century Gothic Bold" Add_textbox.bg="white" Addbutton = PushButton(app, command=addto_todolist, image="Images/add_button.png", grid=[0,4,1,1],align="right") delbutton = PushButton(app, command=delfrom_todolist, image="Images/sub_button.png", grid=[1,4,4,1],align="right") Clearbutton = PushButton(app, command=clear_todolist, image="Images/clear_button.png", grid=[0,5], width=100, height=50, align="left") Clearbutton.bg = "light gray" Citybutton = PushButton(app, command=change_city, image="Images/Change_city_button.png", grid=[0,5], width=160, height=50) Citybutton.bg = "light gray" Weather_drawing = Drawing(app,grid=[0,6,2,1],align="left",width=600,height=300) weather_font_color = which_color(description) Image_picture = which_image(description) update_weather() Weather_drawing.image(0,0,image="Images/" + Image_picture, width=600,height=400) city_num_x = 200 - (len(city_name)*10) city_num_y = 0 Weather_drawing.text(city_num_x,city_num_y, text= city_name, color=weather_font_color,font="Arial",size=40) Weather_drawing.text(135 - len(temp),45, text= temp, color=weather_font_color,font="Arial",size=50) Weather_drawing.text(110 - len(temp),110, text= "Low:" + temp_min, color=weather_font_color,font="Arial",size=15) Weather_drawing.text(225 - len(temp) + len(temp_high)*2,110, text= "High:" + temp_high, color=weather_font_color,font="Arial",size=15) Weather_drawing.text(150 - len(humidity),135, text= "Humidity: " + humidity, color=weather_font_color,font="Arial",size=15) Weather_drawing.text(125 - len(wind_speed),155, text= "Wind Speed: " + wind_speed, color=weather_font_color,font="Arial",size=15) Add_textbox.when_clicked = Make_keys
def StartTwoPlayer(): global twoPlayerWindow global drawButtonTwoPlayer global cardImagesTwoPlayer1 global cardImagesTwoPlayer2 global guessContainerTwoPlayer1 global guessContainerTwoPlayer2 global guessTextBoxTwoPlayer1 global guessTextBoxTwoPlayer2 global guessCheckButtonTwoPlayer global correctTwoPlayer1 global correctTwoPlayer2 global errorTextTwoPlayer twoPlayerWindow = Window(app, title="Two Player Game", layout="grid") twoPlayerWindow.width = 660; twoPlayerWindow.height = 570; twoPlayerWindow.bg = "Lime" drawButtonTwoPlayer = PushButton(twoPlayerWindow, text="Draw!", grid=[0, 0], align="top", padx=20, command=ButtonSwapTwoPlayer) drawButtonTwoPlayer.width = 20; drawButtonTwoPlayer.height = 5; drawButtonTwoPlayer.bg = "White" cardImagesTwoPlayer1 = Box(twoPlayerWindow, layout="grid", grid=[0, 1], align="top", border=True) cardImagesTwoPlayer1.set_border(5, "Lime") cardImagesTwoPlayer2 = Box(twoPlayerWindow, layout="grid", grid=[1, 1], align="top", border=True) cardImagesTwoPlayer2.set_border(5, "Lime") guessContainerTwoPlayer1 = Box(twoPlayerWindow, layout="grid", grid=[0, 2], align="top", border=True) guessContainerTwoPlayer1.set_border(10, "Lime") guessTextBoxTwoPlayer1 = TextBox(guessContainerTwoPlayer1, grid=[0, 0], align="top") guessTextBoxTwoPlayer1.text_size = 20; guessTextBoxTwoPlayer1.bg = "White"; guessTextBoxTwoPlayer1.disable() guessContainerTwoPlayer2 = Box(twoPlayerWindow, layout="grid", grid=[1, 2], align="top", border=True) guessContainerTwoPlayer2.set_border(10, "Lime") guessTextBoxTwoPlayer2 = TextBox(guessContainerTwoPlayer2, grid=[0, 0], align="top") guessTextBoxTwoPlayer2.text_size = 20; guessTextBoxTwoPlayer2.bg = "White"; guessTextBoxTwoPlayer2.disable() pointsTextTwoPlayer1 = Text(guessContainerTwoPlayer1, text="Player One Score: ", grid=[0, 2], align="top") pointsTextTwoPlayer2 = Text(guessContainerTwoPlayer2, text="Player Two Score: ", grid=[0, 2], align="top") guessCheckButtonTwoPlayer = PushButton(twoPlayerWindow, text="Check!", grid=[0, 3], align="top", command=CheckValuesTwoPlayer) guessCheckButtonTwoPlayer.width = 20; guessCheckButtonTwoPlayer.height = 5; guessCheckButtonTwoPlayer.bg = "White"; guessCheckButtonTwoPlayer.disable() correctTwoPlayer1 = Text(guessContainerTwoPlayer1, text="", grid=[0, 3]) correctTwoPlayer2 = Text(guessContainerTwoPlayer2, text="", grid=[0, 3]) errorTextTwoPlayer = Text(twoPlayerWindow, text="Please Enter a Number!", grid=[0, 4]) errorTextTwoPlayer.hide()
def change_city(): global app global window global Display_list, Weather_drawing, Add_textbox, To_do_list_Title, Addbutton, delbutton, Clearbutton, Citybutton, Spotifybutton def Confirm_city(): global city_name if (City_name_entry_textbox.value): city_name = City_name_entry_textbox.value f = open("Weather_loc.txt", "w") f.write(city_name) f.close() Confirmbutton.destroy() City_name_entry_textbox.destroy() City_name_ask_title.destroy() Destroy_keys() init_widgets() if (keys_exist == 1): Destroy_keys() To_do_list_Title.destroy() Add_textbox.destroy() Addbutton.destroy() delbutton.destroy() Citybutton.destroy() Spotifybutton.destroy() Display_list.destroy() Clearbutton.destroy() Weather_drawing.destroy() City_name_ask_title = Text(app, "Type the name of a city:", size=35, font="Century Gothic Bold", color="light gray", grid=[0, 2, 2, 1], align="left") City_name_entry_textbox = TextBox(app, grid=[0, 3], width=50) City_name_entry_textbox.text_size = 12 City_name_entry_textbox.text_color = "Black" City_name_entry_textbox.font = "Century Gothic Bold" City_name_entry_textbox.bg = "white" City_name_entry_textbox.when_clicked = Make_keys Confirmbutton = PushButton(app, command=Confirm_city, image="Images/Confirm.png", grid=[0, 4], width=120, height=50) Confirmbutton.bg = "light gray" app.focus()
def getBanner(text): global banner if banner == None: app = App(title="Information") app.width = 1200 app.height = 1090 app.tk.attributes("-fullscreen", True) banner = TextBox(app, text=text, width="fill", height="fill", multiline=True, align="top") banner.text_size = 50 banner.text_color = "red" app.display() banner = None return banner
PushButton(buttons_box, text="New List", command=new_list, align="left") PushButton(buttons_box, text="Load List", command=load_list_ask, align="left") PushButton(buttons_box, text="Load Store", command=load_store_clear, align="left") # PushButton(buttons_box, text="Clear List", command=ask_clear_list, align="left") PushButton(buttons_box, text="Next Page", command=page_change, args = [1], align="right") PushButton(buttons_box, text="Previous Page", command=page_change, args = [-1], align="right") title_box = Box(app, height="10", align="top", border=False) list_box = Box(app, height="fill", align="right", border=True) # self.text = Text(box, grid=[col+0, row], text=self.disp_text, # align="right", size=text_size) title_box = Text(title_box, align="left", text="") title_box.text_size = text_size list_display = TextBox(list_box, multiline=True, scrollbar=True, height="fill", width=26, align="left", text="") list_display.text_size = text_size content_boxes = [] content_boxes.append(Box(app, align="top", layout="grid", width="fill", border=False)) content_boxes[0].tk.configure(background='white') page_no = 0 default_store = 'stores/Lawrence_Aldi.csv' g_items, item_d = load_store(default_store) disp_list_prev = list() while page_no > 0: page_change(-1) app.when_closed = closing_action auto_load = load_cfg_item(AUTOLOAD_CFG_KEY) if auto_load is not None:
selected=Selectedlist, grid=[0, 3, 2, 1], align="left") Display_list.text_color = "light gray" Display_list.text_size = 20 Display_list.font = "Century Gothic Bold" #Create New list create_list() #Text box for typing ######################################################################################################### global Add_textbox Add_textbox = TextBox(app, grid=[0, 4, 1, 1], width=50, align="left") Add_textbox.text_size = 12 Add_textbox.text_color = "Black" Add_textbox.font = "Century Gothic Bold" Add_textbox.bg = "white" #Add button and add function ######################################################################################################### def addto_todolist(): global Display_list global Todolist global Add_textbox if (Add_textbox.value): f = open("Todolist.txt", "a") f.write(Add_textbox.value + "\n") f.close()
# This block of code sets up the buttons and their functionality within the third (custom temperature) window. window_three = Window(window_one, title="Custom temperature", layout="auto", visible=False) other_info_two = Text(window_three, text="Barrel Temperature") barrel_custom = TextBox(window_three, text="400.0") b_up = PushButton(window_three, text="+", command=b_up_fcn) b_down = PushButton(window_three, text="-", command=b_down_fcn) other_info_three = Text(window_three, text="Nozzle Temperature") nozzle_custom = TextBox(window_three, text="400.0") n_up = PushButton(window_three, text="+", command=n_up_fcn) n_down = PushButton(window_three, text="-", command=n_down_fcn) enter = PushButton(window_three, text="Enter", command=other_temp_set) window_three.bg = "white" # Style block for the widgets within the custom temperature window. nozzle_custom.text_size = 5 barrel_custom.text_size = 5 other_info_two.font = "times new roman" other_info_two.text_size = 10 other_info_three.font = "times new roman" other_info_three.text_size = 10 b_up.text_color = (255, 30, 30) b_up.font = "verdana" b_up.text_size = 10 b_up.bg = "#6C0000" b_down.text_color = (255, 30, 30) b_down.font = "verdana" b_down.text_size = 23 b_down.bg = "#300000" n_up.text_color = (255, 30, 30) n_up.font = "verdana"
text=k, pady=resolution[rt]['button_pady']) btn.bg = "#F84446" counter += 1 btn_list.append(btn) title_box = Box(app, width="fill", align="top", border=True) text_box = TextBox(title_box, text="Copy paste text here and hit ANALYZE", width="100", height="5", multiline='True') text_box.font = "Corbel" text_box.text_size = resolution[rt]['select_box'] preprocess_checkbox = CheckBox(app, text="Analyze Raw Data", command=analyze) analyzebutton = PushButton(title_box, text="Analyze") analyzebutton.when_clicked = analyze button_box_r1 = Box(app, align="top", border=True) button_box_r2 = Box(app, align="top", border=True) button_box_r3 = Box(app, align="top", border=True) button_box_r4 = Box(app, align="top", border=True) button_box_r5 = Box(app, align="top", border=True) button_box_r6 = Box(app, align="top", border=True) button_box_r7 = Box(app, align="top", border=True) button_box_r8 = Box(app, align="top", border=True) form_box = Box(app, width="fill", border=True)
def plot_counts(): print("plot_counts") app = App(layout="grid", title = "EOLT", width = 1500, height = 650) button_box=Box(app, layout="grid", grid=[0, 0, 3, 6], border=3) # Item Numbers itm_num_lbl = Text(button_box, text="1. Choose - Item Number:", size=20, grid=[0,1], align="left") selected_item = Combo(button_box, grid=[1, 1, 2, 1], width=15, options=items, command=update_harnes_fixture_lbl) selected_item.text_size=20 # Serial Numbers serial_label = Text(button_box, text="2. Enter - Serial Number:", size=20, grid=[0,2], align="left") serial_num_txtbox = TextBox(button_box, grid=[1, 2, 2, 1], width=17, command=update_harnes_fixture_lbl) serial_num_txtbox.text_size = 20 # User user_lbl = Text(button_box,text="3. Select - User:"******"left" ) user_lbl.when_double_clicked = double_click user_name_cmb = Combo(button_box,options=users, grid=[1,3, 2, 1], align="left", width=15) user_name_cmb.text_size=20 # Use fixture and harness harness_lbl = Text(button_box, text="4. Use Harness:", size=20, grid=[0, 4], align="left") use_harness = TextBox(button_box, enabled=True, width=17, grid=[1, 4, 2, 1]) use_harness.text_size=20 use_harness.bg = "#999999" fixture_lbl = Text(button_box, text="5. Use Fixture:", size=20, grid=[0,5], align="left") use_fixture = TextBox(button_box, enabled=True, width=17, grid=[1, 5, 2, 1]) use_fixture.bg = "#999999" use_fixture.text_size=20 # Buttons
from guizero import App, TextBox, PushButton, Picture, Box, info, Window, Text import ast, json from time import sleep app = App(title="Bazaar Turflijst") app.tk.attributes("-fullscreen",True) turfknopArea = Box(app, layout="grid", align="left", width="fill", height="fill") #settingknopArea = Box(app,align="left", width="fill", height="fill") textArea = Box(app, align="left", width="fill", height="fill") standText = TextBox(textArea, enabled=False,text="stand", align="left",multiline=True, width = "fill", height = "fill") standText.text_size = 23 doubleCheckWindow = Window(app,title="Zeker weten?", height=300, width=500, visible=False) doubleCheckText = Text(doubleCheckWindow, text="Weet je zeker dat je de stand wilt resetten?", align="top") doublecheckText2 = Text(doubleCheckWindow, text="Dit kan niet ongedaan gemaakt worden.", align="top") voWindow = Window(app, title="73 bravo", height=300, width=500, visible=False) voText = Text(voWindow, text="GEFELICITEERD JIJ ONTZETTENDE VOBAAS", align="top") voText2 = Text(voWindow, text="73 pilsies gemurderd", align="top") superVoWindow = Window(app, title="spiegeltje spiegeltje aan de wand, wie is de grootste pilsbaas van het land?", height=300, width=500, visible=False) superVoText = Text(superVoWindow, text="LEKKER GEZOPEN OUWE!", align="top") superVoText2 = Text(superVoWindow, text="Je hebt de bierlijst gewonnen", align="top") superVoText3 = Text(superVoWindow, text="Check ff op wie je anytimers hebt", align="top") huisgenoten = [] laatsteTurfjes = [] #functions def turf(persoon): feedback()
textspace_center = Text(app, text="xxxxx", size=14, grid=[4, 5, 1, 1], align="left") textspace_center.text_color = "white" #pulse_value =Text(app, text= pulse_signal.value, size=14, grid=[4,6,1,1], align="left") #pulse_value.text_color= "black" #pulse_value.repeat(10,pulseVal) #cumulative_counting =Text(app, text="0", size=14, grid=[4,7,1,1], align="left") #cumulative_counting.text_color= "black" #cumulative_counting.repeat (10,normalCounting) # Text Box # input_target = TextBox(app, text="", grid=[1, 3, 3, 1]) input_target.text_size = 30 input_target.bg = "white" # Keypad # button1 = PushButton(app, Keypad_1, text="1", grid=[1, 4, 1, 1]) button1.bg = "black" button1.text_color = "white" button1.width = 5 button1.height = 2 button1.text_size = 15 button2 = PushButton(app, Keypad_2, text="2", grid=[2, 4, 1, 1]) button2.bg = "black" button2.text_color = "white" button2.width = 5 button2.height = 2 button2.text_size = 15
for each in qText: stackInput.value += each q = queueInput.value stopQ = q.find(",") stopQ += 1 newValues = q[stopQ:] queueInput.width -= stopQ queueInput.value = newValues print(q) dsApp = App(title="Data Structures", width=650, height=800, layout='grid') #Main Box inputBox = Box(dsApp, layout='grid', grid=[0, 0]) txtInput = TextBox(inputBox, text="", width=38, height=1, grid=[1, 0]) txtInput.text_size = 15 PushButton(inputBox, insertText, text="Add Data", grid=[0, 0]) PushButton(inputBox, deleteText, text="Remove Data", grid=[2, 0]) #STACK Box stackBox = Box(dsApp, layout='grid', grid=[0, 2]) stackBox.bg = "limegreen" Text(stackBox, text='Stack', grid=[0, 0]) stackInput = TextBox(stackBox, text="", width=20, height=1, grid=[0, 1], multiline=True) #QUEUE Box queueBox = Box(dsApp, layout='grid', grid=[0, 3])
import time import config from log import log from guizero import App, TextBox logFile = log(config.logFilePath) app = App(title="User Interface", width=config.displayWidth, height=config.displayHeight) text = TextBox(app, width="fill", height="fill", multiline=True, scrollbar=True) text.text_size = config.fontSize text.disable() textBoxData = "" def loop(): """ Loop used to update display """ try: newData = logFile.read("all") global textBoxData for x in reversed(newData):
activate.width = 8 # Delete venv button delete = PushButton(app, delete_venv, text='Delete', grid=[1, 5], align='right') delete.text_size = 14 delete.bg = btn_bg delete.width = 8 """Center padding""" box = Box(app, grid=[2, 1], height='fill', width=30) """Right content""" new_label = Text(app, text='New VENV Name:', grid=[3, 1]) # New venv name texxt input new_venv_name = TextBox(app, grid=[3, 2], width=20) new_venv_name.text_size = 14 new_venv_name.bg = 'white' # Create venv button create_venv_button = PushButton(app, create_venv, text='Create venv', grid=[3, 3], align='left') create_venv_button.text_size = 14 create_venv_button.bg = btn_bg list_virtualenvs() app.display()
ip_button = PushButton(ip_box, command=get_ip, text="Get IP Address", width=30, align="right") ip_button.text_size = 15 ipdisplay = Text(ip_box, text=" ", size=20, font="Lato", color="white") # Contains the button and TextBox for YouTube search based on entered query youtube_box = Box(app, width="fill", align="top", border=False) youtube_box.bg = "#e74c3c" search_query_box = TextBox(youtube_box, width="fill", align="left", multiline=False) search_query_box.text_size = 25 search_query_box.bg = "#dfe6e9" search_button = PushButton(youtube_box, command=search_yt_query, text="Search YouTube", align="right", width=30, height=3) search_button.text_size = 20 search_button.text_color = "white" # Contains the buttons for executing system functions buttons_box = Box(app, width="fill", layout="grid", align="top", border=False) buttons_box.bg = "#3498db" buttons_box.text_color = "white" button13 = PushButton(buttons_box,
title="Settings", width=settings['window_width'], height=settings['window_height']) settings_window.hide() # create ui settings_box = Box(settings_window, layout="grid") i = 0 for key, value in settings.items(): txt = Text(settings_box, text=f"{key}", grid=[0, i], align="left", size=16) txtBox = TextBox(settings_box, text=f"{value}", grid=[1, i], align="left", width=30) txtBox.text_size = 16 i = i + 1 save_btn = PushButton(settings_window, text="Save", align="left", width="fill", height="fill", pady=20) save_btn.when_clicked = save_btn_handler save_btn.text_size = 20 cancel_btn = PushButton(settings_window, text="Cancel", align="left", width="fill", height="fill",
if get_bit(current, i): buttons[i].text = "Dot" else: buttons[i].text = "" else: for i in range(len(buttons)): buttons[i].text = "Invalid button disp" ##### Application Window ##### app = App(title="Braille Writer", layout="grid") currentText = Text(app, text=char, size=64, grid=[0, 0]) outputText = TextBox(app, command=textChanged, text="", grid=[1, 0]) outputText.text_size = 24 brailleTypeCombo = Combo(app, command=changeBrailleType, options=list(brailleTypes), selected=brailleType, grid=[2, 0]) dotButtonWidth = 13 dotButtonHeight = 4 otherButtonWidth = 13 otherButtonHeight = 2 buttons = { 0: PushButton(app, command=flipDot, args=[0],
def h(): app = App(width=800, height=800, title="my first GUI") app.bg = (156, 153, 153) init_control() # menu bar menubar = MenuBar(app, toplevel=["File", "view"], options=[[["music", music_window], ["Exit", exit_app]], [["full-screen", full_screen], ["normal screen", normal_screen]]]) name_box = Box(app, border=1, width="fill") Text(name_box, font="Times New Roman", text="Hosni RPi-GUI-App", width="fill", color=(0, 0, 128)) # win of music Text(app, font="Times New Roman", text="Music", width="fill", color=(145, 15, 15)) music_box1 = Box(app, border=1, width="fill") music_window_button = PushButton( music_box1, align="left", text="Music", command=music_window ) #, image = "/home/pi/Desktop/music/download.png") music_volume_slider = Slider(music_box1, start=100, end=0, command=music_volume, height="fill", width=20, horizontal=False, align="left") music_box2 = Box(music_box1, align="left", width="fill") music_play_button = PushButton(music_box2, text="Play", command=start_music, width="fill") music_pause_button = PushButton(music_box2, text="Pause", command=pause_music, width="fill") music_continue_button = PushButton(music_box2, text="Continue", command=continue_music, width="fill") music_next_button = PushButton(music_box2, text="next", command=next_music, width="fill") music_previous_button = PushButton(music_box2, text="previous", command=previous_music, width="fill") #box3 = Box(box1,align = "left", width = "fill") #music_volume = Slider(box3,start = 100, end = 0 ,command = volume, height = 200, horizontal = False, align = "left") # led intensity text_ledpwm = Text(app, font="Times New Roman", text="LED intensity", width="fill", color=(145, 15, 15)) box4 = Box(app, border=1, width="fill") LEDPwm = Slider(box4, command=LED_intensity_control, width="fill", align="left") LEDPwm.bg = (255, 255, 255) text2 = Text(box4, text="D of LED = 0 %", align="left") text2.text_color = (0, 0, 128) # Fan speed fan_speed_text = Text(app, font="Times New Roman", text="Fan speed", width="fill", color=(145, 15, 15)) fan_speed_box = Box(app, border=1, width="fill") fan_speed_slider = Slider(fan_speed_box, command=fan_speed_control, width="fill", align="left") fan_speed_slider.bg = (255, 255, 255) fan_speed_display = Text(fan_speed_box, text="D of fan= 0 %", align="left") fan_speed_display.text_color = (0, 0, 128) # Ddisplay on lcd lcd_text = Text(app, font="Times New Roman", text="LCD", color=(145, 15, 15)) lcd_box = Box(app, border=1, width="fill") lcd_text_box = TextBox(lcd_box, width="fill", align="left") disply_lcd = PushButton(lcd_box, text="Display", command=display_on_lcd, align="left") lcd_text_box.bg = (255, 255, 255) lcd_text_box.text_size = 15 # Servo motor servo_text = Text(app, font="Times New Roman", text="Servo angle", width="fill", color=(145, 15, 15)) servo_box1 = Box(app, border=1, width="fill") servo_angle = TextBox(servo_box1, width="fill", align="left") rotate = PushButton(servo_box1, text="Rotate", align="left", command=servo_rotate) servo_box2 = Box(app, border=1, width="fill") rotate_0 = PushButton(servo_box2, text="Rotate 0 ", align="left", width="fill", command=servo_rotate_zero) rotate_90 = PushButton(servo_box2, text="Rotate 90", align="left", width="fill", command=servo_rotate_90) rotate_180 = PushButton(servo_box2, text="Rotate180", align="left", width="fill", command=servo_rotate_180) servo_angle.bg = (255, 255, 255) servo_angle.text_size = 15 # Control room light room_text = Text(app, font="Times New Roman", text="Room Light", width="fill", color=(145, 15, 15)) room_box = Box(app, border=1, width="fill") room_turnon = PushButton(room_box, text="Turn on", width="fill", command=turn_on, align="left") room_turnoff = PushButton(room_box, text="Turn off", width="fill", command=turn_off, align="left") room_state = Text(room_box, align="left") room_state.value = "OFF" room_state.text_color = (102, 0, 51) Text(app) # Box which group the four boxes sensors_box = Box(app, width="fill") # display ultrasonic reading ultrasonic_box = Box(sensors_box, border=1, width="fill", align="left") ultrasonic_text = Text(ultrasonic_box, font="Times New Roman", text="Ultrasonic Reading", width="fill", color=(145, 15, 15)) ultrasonic_reading_text = Text(ultrasonic_box, text="the Distance = 0 CM") ultrasonic_reading_text.repeat(200, ultrasonic_measure) # PIR object Detection PIR_box = Box(sensors_box, border=1, width="fill", align="left") PIR_text = Text(PIR_box, font="Times New Roman", text="Object Detection", width="fill", color=(145, 15, 15)) PIR_reading_text = Text(PIR_box) PIR_reading_text.repeat(150, PIR_detect) # Sound sensor sound_box = Box(sensors_box, border=1, width="fill", align="left") sound_text = Text(sound_box, font="Times New Roman", text="Sound Detection", width="fill", color=(145, 15, 15)) sound_reading_text = Text(sound_box) sound_reading_text.repeat(200, sound_detect) # flame sensor flame_box = Box(sensors_box, border=1, width="fill", align="left") flame_text = Text(flame_box, font="Times New Roman", text="Flame Detection", width="fill", color=(145, 15, 15)) falme_reading_text = Text(flame_box) falme_reading_text.repeat(200, flame_detect) app.display()
if __name__ == '__main__': app = App("Chat Companion :)", width=800, height=480, bg=base_color, layout="auto") button_box = Box(app, width="fill", height=40, align="bottom") message_box = Box(app, border=4, height="fill", width="fill") message_box.bg = (255, 255, 255) message = TextBox(message_box, multiline=True, width="fill", height=350, visible=True) message.text_size = 16 chat = ChatHandlerWS() btn_connect = PushButton(button_box, text="Connect", align="left", command=connection_button, args=[chat], width=20, height=30, visible=True, padx=2, pady=2) btn_connect.text_size = 18 btn_connect.bg = "white" btn_connect.show()