if data == b'3' and plano.visible == True: s.sendall(data) ###DECLARA GUI app = App(title="Main", layout="grid", height = 1050 , width = 1680) plano = Window(app,title="Answer") plano.hide() croquis=Picture(plano, image = "plano.gif",grid=[0,0,]) app.tk.attributes("-fullscreen",True) plano.tk.attributes("-fullscreen",True) fondo=Picture(app, image = "fondo.png",grid=[0,0,]) fondo.tk.place(height=1050,width=1680) caja = TextBox(app, grid = [3,4], width = 20, text = "******") caja.tk.place(x=765,y=600) boton_login = PushButton(app,grid=[3,5],text="LOGIN", command = push_login) source_boton = Image.open("b_login.png") boton_login.image=source_boton boton_login.tk.place(x=720,y=650) data = None timeout = 3 # timeout in seconds msg = "test" host = "192.168.1.101" print ("Connecting to " + host) port = 23 s = socket(AF_INET, SOCK_STREAM) print ("Socket made") ready = select.select([s],[],[],timeout)
for y in range(0, 3): # put the pictures and buttons into the lists picture = Picture(pictures_box, grid=[x, y]) pictures.append(picture) button = PushButton(buttons_box, grid=[x, y]) buttons.append(button) # for each picture and button in the list assign an emoji to its image feature for picture in pictures: # make the picture a random emoji picture.image = emojis.pop() for button in buttons: # make the image feature of the PushButton a random emoji button.image = emojis.pop() # import the randint function from random import randint # choose a new emoji matched_emoji = emojis.pop() # select a number at random random_picture = randint(0, 8) # change the image feature of the Picture with this index in the list of pictures to the new emoji pictures[random_picture].image = matched_emoji random_button = randint(0, 8) # change the image feature of the PushButton with this index in the list of buttons to the new emoji buttons[random_button].image = matched_emoji
###DECLARA GUI app = App(title="Main", layout="grid", height=1050, width=1680) plano = Window(app, title="Answer") plano.hide() croquis = Picture(plano, image="/home/pi/Documents/plano.png", grid=[ 0, 0, ]) app.tk.attributes("-fullscreen", True) plano.tk.attributes("-fullscreen", True) fondo = Picture(app, image="/home/pi/Documents/fondo.png", grid=[ 0, 0, ]) fondo.tk.place(height=1050, width=1680) caja = TextBox(app, grid=[3, 4], width=20, text="******") caja.tk.place(x=765, y=600) boton_login = PushButton(app, grid=[3, 5], text="LOGIN", command=push_login) source_boton = Image.open("/home/pi/Documents/b_login.png") boton_login.image = source_boton boton_login.tk.place(x=720, y=650) boton_logout = PushButton(plano, grid=[3, 5], text="LOGOUT", command=push_logout) boton_logout.image = source_boton boton_logout.tk.place(x=720, y=650) app.display()