#๐Ÿ”’ customtkinter scrollableframe help

14 messages ยท Page 1 of 1 (latest)

sage dirge
#

hi, i'm trying to make a gpa calculator that has an option to send grades to a transcript from a ctk listbox which values are concatenated in separate lists. now i'm trying to insert the respected lists into a single concatenated list value to put in the scrollableframe, but i'm having some issues, help is appreciated!

sour plankBOT
#

@sage dirge

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.

sage dirge
#
def submit(self): 
            global list_data 
            list_data+=1 
            global spaces
            if len(self.entry.get())<=20:
                spaces_to_add = 20-len(self.entry.get())
                int(spaces_to_add)

            for i in range(spaces_to_add):
                spaces=spaces+" "
                
            list_grades.append(self.optionmenu_1.get()) 
            list_weights.append(self.optionmenu_2.get()) 
            
            if self.entry.get() in list_names:
                if askyesno("Duplicate course", "The course '"+self.entry.get()+"' already exists in your list of submitted data. Are you sure you wish to add it again?") == True: 
                    list_names.append(self.entry.get()) 
                    print("yes")
                    self.listbox.insert(list_data,"  "+self.entry.get()+spaces+" "+"\t"+self.optionmenu_1.get()+"\t"+self.optionmenu_2.get()) 
                else: 
                    print("no")
                    #pass
            else: 
                list_names.append(self.entry.get())
                self.listbox.insert(list_data,"  "+self.entry.get()+spaces+" "+"\t"+self.optionmenu_1.get()+" "+"\t"+self.optionmenu_2.get()) 
            
            print(len(self.entry.get()))
            spaces=""```
#

that is my submit function which adds it into the listbox

charred hawk
#

hello

sage dirge
#

each of those values is in a separate list
so

list_names = ["Math", "English", "History"]
list_grades = ["A+", "A+", "B"]
list_weights = ["Regular (1)", "AP", "Regular (2)"]

#

and i'm trying to make it so that when prompted "Do you want to add this grade to your transcript?" and if the answer is True, then it'll add each value to a new list and then be inserted into the scrollableframe of classes + info
so

transcript_info = ["Math A+ Regular (1)", "English A+ AP", "History B Regular (2)"]

#

this is what i have currently, it's not giving me an error but it's not sending it into the scrollableframe

if askyesno("Transcript", "Would you like to send this grade to your transcript?") == True: 
                #transcriptdata = list_data,"  "+self.entry.get()+spaces+" "+"\t"+self.optionmenu_1.get()+" "+"\t"+self.optionmenu_2.get()
                t=0
                for t in range(list_data):
                    transcript_info = list_names[t]+list_grades[t]+list_weights[t]
                    self.scrollable_frame_data.append(transcript_info)
                    print(transcript_info)```
sage dirge
# charred hawk hello

hi, i put info on what i'm trying to do, if you need clarification on anything, lmk, thanks!

charred hawk
#

aight np

#

thx

sour plankBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.