-3

I am writing a program on python, but window outupt none, but i need that it output ins pls help me i am new at python code:

from typing import Text
import PySimpleGUI as sg
x = 'none'
z = 'none'
layout = [
   [sg.Text('Welcome')],
   [sg.Text('There you can install apps')],
   [sg.Button('hi', key='install')]
]

window = sg.Window('Apps Installer', layout)
layout2 = [
    [sg.Text(z)]
]
while True:                             # The Event Loop
    event, values = window.read()
    # print(event, values) #debug
    if event in ('install'):
        x = "steam"
        window = sg.Window('Apps Installer', layout2)
    else:
        break
if (x == 'steam'):
        z = 'ins'
layout2 = [
    [sg.Text(z)]
]
Ivanoio
  • 3
  • 3
  • You don’t seem to use the `typing` module; `from typing import Text` has no effect in your code. – Konrad Rudolph Jan 02 '22 at 16:49
  • 1
    It didn't tell us what you are doing in your description or code. – Jason Yang Jan 03 '22 at 03:50
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 10 '22 at 00:05

1 Answers1

1

If nothing wrong, your code should be like this

import PySimpleGUI as sg

sg.theme("DarkBlue3")

x, z = 'none', 'none'

layout = [
   [sg.Text('Welcome')],
   [sg.Text('There you can install apps')],
   [sg.Button('hi', key='install')]
]

window = sg.Window('Apps Installer', layout)

while True:                             # The Event Loop
    event, values = window.read()
    # print(event, values) #debug
    if event in ('install', ):
        x = "steam"
        if x == "steam":
            z = "ins"
            sg.theme("LightBlue3")
            layout2 = [[sg.Text(z), sg.Button("OK")]]
            win = sg.Window('Apps Installer', layout2, modal=True)
            win.read(close=True)
    else:
        break

window.close()
Jason Yang
  • 11,284
  • 2
  • 9
  • 23
  • What is the main difference between your code and the question's code? Just the `sg.theme("...")` calls? This could really need some explanation... – Robert Jan 03 '22 at 15:24
  • Not the theme used, the main difference is the way to call sub window and how to process event in event loop. – Jason Yang Jan 03 '22 at 15:42