def add_pairs(self): jsonfiles = os.listdir(os.path.join(self.datafolder, "telegram_data")) while len(jsonfiles) <= 1: sleep(300) row = 2 for file in jsonfiles: if not "data.json" in file: data = self.read_file(file) tpair = TextBox(app, grid=[0, row], width=15, align="top") exchange = TextBox(app, grid=[1, row], width=15) lastaction = TextBox(app, grid=[2, row], width=15) curprice = TextBox(app, grid=[3, row], width=15) margin = TextBox(app, grid=[4, row], width=15) delta = TextBox(app, grid=[5, row], width=15) ERI = TextBox(app, grid=[6, row]) BULL = TextBox(app, grid=[7, row]) EMA = TextBox(app, grid=[8, row]) MACD = TextBox(app, grid=[9, row]) OBV = TextBox(app, grid=[10, row]) tpair.value = file.replace(".json", "") exchange.value = data[ "exchange"] if "exchange" in data else "waiting to buy" margin.repeat(5100, self.update_textbox, args=[margin, file, "margin"]) delta.repeat(5100, self.update_textbox, args=[delta, file, "delta"]) curprice.repeat(5100, self.update_textbox, args=[curprice, file, "price"]) lastaction.repeat(5100, self.update_lastaction, args=[lastaction, file]) ERI.repeat(5100, self.update_indicator, args=[ERI, file, "ERI"]) BULL.repeat(5100, self.update_indicator, args=[BULL, file, "BULL"]) EMA.repeat(5100, self.update_indicator, args=[EMA, file, "EMA"]) MACD.repeat(5100, self.update_indicator, args=[MACD, file, "MACD"]) OBV.repeat(5100, self.update_indicator, args=[OBV, file, "EMA"]) row += 1
def tasto2(): plt.scatter(coordX,coordY) plt.plot(coordX,coordY) plt.ylabel('some numbers') plt.show() plt.savefig("grafico.png") picture = Picture(app, image="grafico.png") output.append(picture) app = App(title='interfaccia-grafico') grafico_text = Text(app, text='Grafico', font = 'arial', size=40) whatever = TextBox(app, width=50, multiline=True, height=2) whatever.value='Interfaccia grafico' output = TextBox(app, width=80, height=10, multiline=True) push1 =PushButton(app, text='definire le coordinate', command=tasto0) push2 =PushButton(app, text='coordinate', command=tasto1) push3 = PushButton(app, text='grafico', command=tasto2) app.bg="#000000" grafico_text.text_color ="#FFFFFF" whatever.bg="#FFFFFF"
def test_getters_setters(): a = App() t = TextBox(a) t.value = "foo" assert t.value == "foo" a.destroy()
def settingsmenu(): #try: #change settings in here global RUN global MACHINE global LIFEMON_INT global FILEMON_INT global URLMON_INT global PATH global URL global app global lifemoncheck global urlmoncheck global urlinput global filemoncheck global pathinput global SERVER global serverinput global machineinput global firstwindow global settingswindow RUN = False readfile() ORIGIN = "Settings Menu" #convert variables for use LIFEMON_INT = booltoint(LIFEMON, ORIGIN) FILEMON_INT = booltoint(FILEMON, ORIGIN) URLMON_INT = booltoint(URLMON, ORIGIN) #setup settings UI #settingswindow = Window(app, title="Erelas monitoring system - settings") #machine name settings machinetext = Text(settingswindow, text = "Machine name", grid=[0,0]) machineinput = TextBox(settingswindow, grid= [1,0]) machineinput.value = MACHINE #server settings servertext = Text(settingswindow, text = "Server IP address", grid=[0,1]) serverinput = TextBox(settingswindow, grid=[1,1]) serverinput.value = SERVER #life monitor section lifemontext = Text(settingswindow, text = "Activate CPU / RAM / disk monitor", grid=[0,2]) lifemoncheck = CheckBox(settingswindow, text = "Report CPU use", grid=[1,2]) lifemoncheck.value = LIFEMON_INT #url monitor section urlmontext = Text(settingswindow, text = "Activate URL monitor", grid=[0,3]) urlmoncheck = CheckBox(settingswindow, text = "Report URL status", grid = [1,3]) urlmoncheck.value = URLMON_INT urlinputtext = Text(settingswindow, text = "Enter URL to monitor", grid=[0,4]) urlinput = TextBox(settingswindow, grid=[1,4]) urlinput.value = URL #file monitor sections filemontext = Text(settingswindow, text = "Activate file modified monitor", grid=[0,5]) filemoncheck = CheckBox(settingswindow, text = "Report most recent file update", grid=[1,5]) filemoncheck.value = FILEMON_INT pathinputtext = Text(settingswindow, text = "Path to monitor files at", grid=[0,6]) pathinput = TextBox(settingswindow, grid=[1,6]) pathinput.value = PATH if FIRSTRUN == True: firstwindow.hide() savebutton = PushButton(settingswindow, text="Save and run", command = savesettings, grid=[0,7]) quitbutton = PushButton(settingswindow, text="Quit", command= quit, grid= [1,7]) else: #save section savebutton = PushButton(settingswindow, text="Save and apply changes", command = savesettings, grid=[0,7]) resetbutton = PushButton(settingswindow, text="Discard changes and reset to previous values", command= resetsettings, grid = [1,7]) #quit section closerunbutton = PushButton(settingswindow, text="Close and run", command= closerun, grid=[0,8]) closenorunbutton = PushButton(settingswindow, text="Close and don't run", command= closenorun, grid=[1,8]) settingswindow.show()
txt_from_raw_data.text_color = style.parameter_Color cbo_from_raw_data = Combo(app, options=["True", "False"], align="left", grid=[2, 9], selected="True") cbo_from_raw_data.when_mouse_enters = txt_from_raw_data_ex txt_initial_timeshift = Text(app, text="initial_timeshift:", align="left", grid=[1, 10]) txt_initial_timeshift.text_size = style.parameter_Size txt_initial_timeshift.text_color = style.parameter_Color tbx_initial_timeshift = TextBox(app, align="left", grid=[2, 10], width=30) tbx_initial_timeshift.value = 0 tbx_initial_timeshift.when_mouse_enters = txt_initial_timeshift_ex txt_metric = Text(app, text="metric:", align="left", grid=[1, 11]) txt_metric.text_size = style.parameter_Size txt_metric.text_color = style.parameter_Color tbx_metric = TextBox(app, align="left", grid=[2, 11], width=30) tbx_metric.value = "map" tbx_metric.when_mouse_enters = txt_metric_ex txt_filter_tetrodes = Text(app, text="filter_tetrodes:", align="left", grid=[1, 12]) txt_filter_tetrodes.text_size = style.parameter_Size txt_filter_tetrodes.text_color = style.parameter_Color
("samrakhalid00", current, convertToBinaryData( "/home/pi/Documents/det_and_recog/" + name + ".jpg"), name + " Has entered the house!")) mariadb_connection.commit() cursor.close() break else: print("wrong pin!") count = count + 1 if count > 60000: try: app.destroy() except: pass my_pin.value = 0 break relay.off() cursor = mariadb_connection.cursor() cursor.execute("""DELETE FROM Door WHERE Username=%s""", ("samrakhalid00", )) cursor.execute( """INSERT INTO Door (Username,Status) VALUES (%s,%s)""", ("samrakhalid00", 0)) mariadb_connection.commit() print("door still locked") cursor = mariadb_connection.cursor() now = datetime.now() current = now.strftime("%m/%d/%Y, %H:%M:%S") cursor.execute( """INSERT INTO securitynotifications (Username,Time,Image,Message) VALUES (%s,%s,%s,%s)""",
print("X: ", coordX) print("Y: ", coordY) coordX.sort() coordY.sort() print("liste ordinate:") print("X: ", coordX) print("Y: ", coordY) print(type(coordX)) print(type(coordY)) plt.plot(coordX, coordY) plt.ylabel('some numbers') plt.show() app = App(title='interfaccia') hello_text = Text(app, text='interfaccia', font='Arial', size=40) whatever = TextBox(app, width=30, multiline=True, height=2) whatever.value = 'interfaccia/grafico' push = PushButton(app, text='grafico', command=bottone0) push.width = 8 push.height = 3 app.display()
sleep(0.1) outputText.value = "End Tracking" #graf=Picture(app, image="plot.png", grid = [0,4]) #sleep(5) #mngr=plt.get_current_fig_manager() #sleep(2) #mngr.window.wm_geometry("+10+200") #sleep(2) #input("Press Enter to continue...") app = App(title="gpi", width=650, height=250, layout="grid") dirs = [item for item in list(os.walk("."))[0][1] if not item.startswith(".")] videoname = TextBox(app, grid=[1, 3], align="left") videoname.value = "videoname" labelVN = Text(app, grid=[0, 3], text="video name", align="left") wdText = Text(app, grid=[1, 0], text="folder", align="left") timeRecording = TextBox(app, grid=[1, 5], align="left") timeRecording.value = "3" labelTime = Text(app, grid=[0, 5], text="record time", align="left") browserDir = Combo(app, options=dirs, command=select, grid=[0, 0], align="left")
] next_overlay_btn = Button(23) take_pic_btn = Button(25) camera = PiCamera() camera.resolution = (800, 480) camera.hflip = True camera.rotation = 90 camera.start_preview() output = "" latest_photo = '/home/pi/allseeingpi/latest.gif' next_overlay_btn.when_pressed = next_overlay take_pic_btn.when_pressed = take_picture app = App("The All-Seeing Pi", 800, 480, bg="#6ABF4B") app.tk.attributes("-fullscreen", True) header_pic = Picture(app, image="pprjam.png") your_pic = Picture(app, latest_photo) new_pic = PushButton(app, new_picture, text="New picture") new_pic.bg = "#B61845" text = Text(app, text="Enter your Twitter Handle below (optional)") twitter_username = TextBox(app, width=17) twitter_username.value = "@" #twitter_username.when_clicked = screen_keyboard tweet_pic = PushButton(app, send_tweet, text="Tweet picture") tweet_pic.bg = "#1DA1F2" app.display()
from guizero import App, Text, TextBox, PushButton app = App(title='HelloWorld!!') hello_text = Text(app, text='HelloWorld!!', font='Helvetica', size=60) whatever = TextBox(app, width=50, multiline=True, height=5) whatever.value = 'Something Cool' button = PushButton(app, text='Push Me!!') button.width = 6 button.height = 3 app.display()
spacer = Text(admin_window, text=" ", size=5, grid=[0, 2]) spacer = Text(admin_window, text="Change Frequencies", size=15, grid=[2, 3, 3, 1]) admin_freq1 = TextBox(admin_window, grid=[2, 4, 3, 1]) admin_freq2 = TextBox(admin_window, grid=[2, 5, 3, 1]) admin_freq3 = TextBox(admin_window, grid=[2, 6, 3, 1]) admin_freq4 = TextBox(admin_window, grid=[2, 7, 3, 1]) spacer = Text(admin_window, text=" ", size=5, grid=[2, 8, 3, 1]) btn_save_freqs = PushButton(admin_window, command=change_freqs, text="Save Frequencies", grid=[2, 9, 3, 1]) admin_freq1.value = freqs[0] admin_freq2.value = freqs[1] admin_freq3.value = freqs[2] admin_freq4.value = freqs[3] spacer = Text(admin_window, text=" ", size=20, grid=[2, 10]) spacer = Text(admin_window, text="General Admin", size=15, grid=[2, 11, 3, 1]) spacer = Text(admin_window, text=" ", size=5, grid=[2, 12]) tempText = Text(admin_window, text='temp', grid=[2, 13, 3, 1]) updateTemp() btn_close_admin = PushButton(admin_window, command=close_admin, text="Close Admin Page", grid=[2, 14]) btn_kill = PushButton(admin_window,
from guizero import App, TextBox, PushButton, Text def show(): output.value = textbox.value app = App() textbox = TextBox(app, multiline=True, height=10, width=50, scrollbar=True) textbox.value = "hello\ngoodbye\nno way\nthis is a very long stream of text, very long indeed, the best long line of text, its super bigly and very long, I dont think it could possibly be any better particularly as it was created by someone who is super good at creating long lines of text." button = PushButton(app, text="Print", command=show) output = Text(app) app.display()