Python ListBox And TextBox


Python ListBox And TextBox 

def saver_button():
        st=text_frm1.get("1.0",END)
        with open("records.txt","a") as file:
            file.write(st)      
        text_frm1.delete(1.0,END)
     
        with open("ListAdd.txt","a") as dosya:
            k=IntVar()
            k=lstBx.size()
            i=0
            for i in range(0,k):
                temp=lstBx.get(i)
                dosya.write(temp)
                dosya.write("\n")
             
            lstBx.delete("0",END)

text_frm1 : Text widget(Frame içine konulmak için oluşturuldu).
index yerini tutması için IntVar() olarak düzenlendi.
size()lstBx in içindeki toplam eleman sayısını döndürüyor.
get() Verilen indexteki elemanı almak.
delete(first, last) ilk ve son indexler belirtip silme yapabilme.
write():Dosyaya yazabilme amaçlı.
Dosya işlemlerinde ekleme modu
Dosya işlemlerinde okuma modu.
range():Döngüde aralıkları belirtebilme

Comments

Popular posts from this blog

Tech Duos For Web Development

CIFAR-10 Dataset Classification Using Convolutional Neural Networks (CNNs) With PyTorch

Long-short-term-memory (LSTM) Word Prediction With PyTorch