Reputation: 5
I made a gui in PySimpleGUI and created 3 columns but when i try to add a fourth one it goes on the other column and does This.I want that the column where i store the buttons stays in his position. Here 's the code too. Is it possible to change the index? Here another image to let you see how the work should be the only difference is that i want to add colc(the name of the column) to stay in the white part.
# Import delle liberie
from config import *
import tkinter as tk
import PySimpleGUI as sg
import datetime
font = ("Times New Roman", 11)
#import di tkinter per
x = tk.Tk()
x.withdraw()
now = datetime.datetime.now()
time=now.strftime("%Y-%m-%d %H:%M:%S")
width = x.winfo_screenwidth()
height = x.winfo_screenheight()
size = (140, height)
size1 = (width, 100)
colc= [
[sg.Text("testo"), sg.Input()],
[sg.Text("testo"), sg.Input()],
[sg.Text("testo"), sg.Input()],
[sg.Text("testo"), sg.Input()],
[sg.Text("testo"), sg.Input()]
]
inputbottom = [
[sg.Text("Input →", background_color="blue"), sg.Input(size=(209, 50))],
]
logo = [
[sg.Image(filename ='img/logo.png', background_color="blue")],
]
col1 = [
[sg.Text(time, justification="c", background_color="blue", key='-TEXT-')],
[sg.Button("Avvia Standard", size=(14, 6), button_color=('gray'),)],
[sg.Button("Avvia Multipla", size=(14, 6), button_color=('gray'))],
[sg.Button("Concludi Singola", size=(14, 6), button_color=('gray'))],
[sg.Button("Concludi tutto", size=(14, 6), button_color=('gray'))],
[sg.Button("Mostra Attive", size=(14, 6), button_color=('gray'))],
[sg.Button("Login", size=(14, 6), button_color=('gray'),)],
[sg.Button("Logout", size=(14, 6), button_color=('gray'))]
]
frametop = [[sg.Column(logo, background_color='Blue')]]
buttons = [[sg.Column(col1,background_color='Blue')]]
layout = [
[sg.Column(frametop, size=size1, background_color='Blue', justification="top", pad=(0, 0))],
[sg.Column(colc, pad=(0,0))],
[sg.Column(buttons, size=(140, 845), background_color='Blue', justification="right", pad=(0, 0))],
[sg.Column(inputbottom, justification="top", background_color="Blue", size=(width, 400), pad=(0,0))],
]
window = sg.Window('CMF-GESTIONALE',layout,resizable=True, finalize=True,size=(width, height),icon='img/Icona.ico',background_color='white', font=font,margins=(0,0)).Finalize()
window.Maximize()
# Eventi Bottoni
while True:
event, values = window.read()
if event == sg.WIN_CLOSED or event == 'Logout':
break
if event == 'Avvia Standard':
print("-")
if event == 'Avvia Multipla':
print("-")
if event == 'Concludi Singola':
print("-")
if event == 'Concludi tutto':
print("-")
if event == 'Mostra Attive':
print("-")
if event == 'Login':
print("-")
window.close()
Upvotes: 0
Views: 365
Reputation: 13057
If you need layout with left column and right column, example code here
import PySimpleGUI as sg
sg.theme("DarkBlue3")
sg.set_options(font=("Courier New", 16))
left = [[sg.Text("testo"), sg.Input()] for i in range(5)]
right = [[sg.Button(f"Button {i}")] for i in range(10)]
layout = [
[sg.Text("Top Line")],
[sg.Column(left, vertical_alignment='top'), sg.Column(right, vertical_alignment='top')],
[sg.Text("Bottom Line")],
]
window = sg.Window('Title', layout, finalize=True)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
break
print(event, values)
window.close()
Upvotes: 1