Python Forum
Pysimplegui - Windows location
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pysimplegui - Windows location
#3
Hello there,

Apologies, a mock up, shortened version of my code is below and the error is further down.

import PySimpleGUI as sg
a = ()
def start():
    layout1 = [[sg.Button("Next")]]
    window1 = sg.Window("Test",layout1,size=(300,300),finalize=True)
    event,values = window1.read()
    a = window1.CurrentLocation()
    print(a)
    print(type(a))
    while True:
        if event == sg.WIN_CLOSED:
            break
        if event == "Next":
            window1.close()
            nextp()
            break
def nextp():
    global a
    layout2 = [[sg.T("")]]
    window2 = sg.Window("Test2",layout2,location=a,size=(300,300),finalize=True)
    event,values=window1.read()
start()
Error:
ValueError: not enough values to unpack (expected 2, got 0)
Now, as you can see I created an empty tuple to store the location (As it needs to be shared between functions, I've had to use a global one) and I've also printed the contents of 'a' which does display the x,y co-ordinates of the window, and changes depending on where the window is.

However it is saying there are no arguments given, which confuses me as they're there! :')

Thanks,
James
while dad_has_cigs == True:
    happiness = True
    if dad_has_cigs == False:
    print("Dad come home!")
    happiness = not happiness
    break
Reply


Messages In This Thread
Pysimplegui - Windows location - by jamesaarr - Sep-09-2021, 03:47 PM
RE: Pysimplegui - Windows location - by deanhystad - Sep-09-2021, 04:40 PM
RE: Pysimplegui - Windows location - by jamesaarr - Sep-10-2021, 08:52 AM
RE: Pysimplegui - Windows location - by jamesaarr - Sep-10-2021, 09:07 AM
RE: Pysimplegui - Windows location - by FullOfHelp - Sep-11-2021, 02:15 PM
RE: Pysimplegui - Windows location - by jamesaarr - Sep-13-2021, 08:15 AM
RE: Pysimplegui - Windows location - by FullOfHelp - Sep-13-2021, 05:04 PM
RE: Pysimplegui - Windows location - by FullOfHelp - Sep-13-2021, 05:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PySimpleGUI Try Except jamesaarr 1 2,821 Nov-18-2021, 02:02 PM
Last Post: jamesaarr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020