Allow maximize and minimize windows in Pysimplegui

Asked

Viewed 44 times

0

I’m trying to make a text/note program, like Word or notepad in Pysimplegui. Before I started doing it, I needed test programs, and in one of them I have a problem: allow to maximize and return to the original size. I did a lot of research and found the maximize, that maximized the screen, but did not allow alternating. Until I thought I could have a event for that, and I just can’t find anything about it. Follows my code:

import tkinter as tk
from PySimpleGUI import PySimpleGUI as sg
sg.theme('Default1')
layout = [
    [sg.Text('oi')]
    ]
x = sg.Window('teste', layout=layout, finalize=True, size = (600,600))
x.maximize()
while True:
    event, values = x.read()
    if event == sg.WINDOW_CLOSED:
        break

So how could I activate the maximize/return to the original window size in Pysimplegui?

I’m using Windows 10 Pro, 64bit.

Please comment on any error in the question for me to change it!

1 answer

0


Looking at the documentation (readthedocs.io), see that you have the option resizable = False,, the standard is False then just adjust to True, example:

# -*- coding: utf-8 -*-

import PySimpleGUI as sg

sg.theme('DarkAmber')

layout = [  [sg.Text('Foo')],
            [sg.Text('Bar'), sg.InputText()],
            [sg.Button('Confirmar'), sg.Button('Cancelar')] ]

window = sg.Window('Window Title', layout, resizable = True)

while True:
    event, values = window.read()
    if event == sg.WIN_CLOSED or event == 'Cancelar':
        break

    print('Você escreveu: ', values[0])

window.close()
  • @Arturcarneirobarroso this is already another doubt the part, it would fit better in a new question.

  • I’ve found a way, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.