#๐Ÿ”’ AttributeError but it doesnt make sense at all

6 messages ยท Page 1 of 1 (latest)

worthy creekBOT
#

@fervent dagger

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

fervent dagger
#
import pygetwindow
import pyautogui
import time
import traceback
import customtkinter

ScreenX,ScreenY = pyautogui.size()
WindowSearchTimeoutValue = 10

WMS = customtkinter.CTk()

WMS.title("WMS")
WMS.geometry("300x250")
WMS.resizable(0, 0)

customtkinter.set_default_color_theme("dark-blue")
customtkinter.set_appearance_mode("dark")

TitlesList = ["discord","thonny","wms"]

def Run():
  print("not made yet lol")
  
def UpdateTitles(CurrentTitlesLabel):
    LeftWindowName = input("Please type the name of the left window.\n> ")
    MainWindowName = input("Please type the name of the main window.\n> ")
    RightWindowName = input("Please type the name of the right window.\n> ")
    SelectedTitles = [LeftWindowName,MainWindowName,RightWindowName]
    Value = True
    
    global TitlesList
    
    for IndexValue,Title in enumerate(SelectedTitles):
        if len(pygetwindow.getWindowsWithTitle(Title)) == 0:
            Value = False
        else:
            continue
    
    print(Value)
    
    if Value == True:
        TitlesList = SelectedTitles
        print(TitlesList)
        CurrentTitlesLabel.configure(text=f"Current Titles: {TitlesList}") # error here after returning from below
        return TitlesList
    else:
        print("Error: Windows not found")
        if input("Press [1] to re-update titles.\n> ") == "1":
            print(TitlesList)
            return UpdateTitles(TitlesList) # re running it triggers the error for some reason??
        else:
            return TitlesList
            
def Main():
    TitleLabel = customtkinter.CTkLabel(WMS, text="Window Management Software\nVersion: 4.5", font=("Arial", 16, "bold"))
    TitleLabel.pack(pady=15)
    OptionsLabel = customtkinter.CTkLabel(WMS, text="Please select an option", font=("Arial", 14, "bold"))
    OptionsLabel.pack()
    
    
    RunButton = customtkinter.CTkButton(WMS, text="Run Software", font=("Arial", 14, "bold"))
    RunButton.pack(pady=5)

    AssignNewTitlesButton = customtkinter.CTkButton(WMS, text="Assign New Titles", font=("Arial", 14, "bold"))
    AssignNewTitlesButton.pack(pady=5)

    QuitButton = customtkinter.CTkButton(WMS, text="Quit", font=("Arial", 14, "bold"))
    QuitButton.pack(pady=5)
    
    
    CurrentTitlesLabel = customtkinter.CTkLabel(WMS, text=f"Current Titles: {TitlesList}", font=("Arial", 13, "bold"))
    CurrentTitlesLabel.pack()
    
    RunButton.configure(command=lambda: Run(Titles))
    AssignNewTitlesButton.configure(command=lambda: UpdateTitles(CurrentTitlesLabel))
    QuitButton.configure(command=WMS.destroy)


    WMS.mainloop()
Main()

#

i dont understand at all lol

worthy creekBOT
#
Python help channel closed using Discord native close action

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.