ı made personal library code there we add new books, delete them ,borrow them, and give them back and also search them but the borrow button doesnt work as it should ı cant code it
firstly it should ask the book name which is gonna be borrowed and if it finds the book then it will ask the borrower name . it asks the book name and borrower name but it always says there isnt any book which has this name
there is also a parameter odunc_alındı_mı : 1/0 when this button works make this parameter 1 and then it should create a parameter which is named odunc_alan (borrowers name) and save those with sqlite3 but it dosent even create the parameter borrowers name
heres the full code : https://paste.pythondiscord.com/YVBA
#🔒 Button isnt functioning as it should.(my bad but ı got no clue how to fix)
46 messages · Page 1 of 1 (latest)
@lime hill
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.
Closes after a period of inactivity, or when you send !close.
if I understand correctly, you think the problem is in this function?
def odunc_al(self, ad):
isim = simpledialog.askstring('Ödünç Al', 'Kitabı Ödünç Alan Kişinin Adı:')
if isim is None:
messagebox.showerror('Hata', 'Kitap Adı Gerekli. Ödünç Alma İşlemi İptal Edildi.')
return
kitap = self.kitap_ara(ad)
if kitap and not kitap.odunc_alindi_mi:
kitap.odunc_alindi_mi = True
kitap.odunc_alan = isim
self.cursor.execute("UPDATE kitaplar SET odunc_alindi_mi=1, odunc_alan=? WHERE ad=?", (isim, ad))
self.conn.commit()
return f"'{ad}' başlıklı kitap ödünç alındı. {isim} isimli kişi kitabı ödünç aldı."
elif kitap:
return f"'{ad}' başlıklı kitap zaten ödünç alınmış."
else:
return f"'{ad}' başlıklı kitap bulunamadı."
yes
and specifically this condition, since you think this line isn't running?
if kitap and not kitap.odunc_alindi_mi:
probably
i'd add a print statement in that block to confirm whether or not it's executing
and then print kitap and kitap.odunc_alindi_mi to check what they are
narrow down where the problem is coming from, basically
ı never thought about that seems pretty good
how am ı supposed do this thing ?
nevermind those i tried something like this
this is the error even the ai isnt helping
you're passing too many arguments to the function
or your function definition doesn't accept enough arguments
and if u read the function it seems to ask them by it self and the fix is prob not accepting them but not giving them instead
ok now ı returned to the start
help me step by step like ım literally noob
please guys
ok, did you figure out whether that if-block is executing like you expect it to?
ı reached just this there isnt a problem
now ım checking the code all over second time to notice where is my mistake
can this be maybe ?
@dusky dagger yo ı found the problem
nice
how can ı fix this now ????
sounds like that column needs to exist
yeah ı see taht
that
how can ı make that column ??
will db browser be enough ??
nah it wont ðŸ˜
that'd be something to look up in the sqlite documentation
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.