why this is showing TypeError: 'builtin_function_or_method' object is not subscriptable [closed]

Multi tool use
Multi tool use











up vote
0
down vote

favorite












from tkinter import *
from tkinter import messagebox

class after_sign_in(object):
def __init__(self):
self.sign_in_after()
def sign_in_after(self):
self.sign_in=Tk()
self.sign_in.geometry('700x300')
self.sign_in.maxsize(height=300,width=700)
self.sign_in.title('Account')
def sign_out():
messagebox.showinfo('Have A Nice Day','You Are Signed Out')
self.sign_in.destroy()
sign_out=Button(self.sign_in,anchor='ne',text='Sign Out',command=sign_out)
sign_out.pack(side='right')
sign_out.place(x=620,y=5)
fh=open('fh.txt','r+')
_row=0
ct =1
for i in range(len(fh.readlines())):
Label(self.sign_in, text=fh.readlines[i], width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)

t=after_sign_in()









share|improve this question















closed as off-topic by tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja Nov 9 at 14:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
    – UnholySheep
    Nov 9 at 12:52















up vote
0
down vote

favorite












from tkinter import *
from tkinter import messagebox

class after_sign_in(object):
def __init__(self):
self.sign_in_after()
def sign_in_after(self):
self.sign_in=Tk()
self.sign_in.geometry('700x300')
self.sign_in.maxsize(height=300,width=700)
self.sign_in.title('Account')
def sign_out():
messagebox.showinfo('Have A Nice Day','You Are Signed Out')
self.sign_in.destroy()
sign_out=Button(self.sign_in,anchor='ne',text='Sign Out',command=sign_out)
sign_out.pack(side='right')
sign_out.place(x=620,y=5)
fh=open('fh.txt','r+')
_row=0
ct =1
for i in range(len(fh.readlines())):
Label(self.sign_in, text=fh.readlines[i], width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)

t=after_sign_in()









share|improve this question















closed as off-topic by tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja Nov 9 at 14:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
    – UnholySheep
    Nov 9 at 12:52













up vote
0
down vote

favorite









up vote
0
down vote

favorite











from tkinter import *
from tkinter import messagebox

class after_sign_in(object):
def __init__(self):
self.sign_in_after()
def sign_in_after(self):
self.sign_in=Tk()
self.sign_in.geometry('700x300')
self.sign_in.maxsize(height=300,width=700)
self.sign_in.title('Account')
def sign_out():
messagebox.showinfo('Have A Nice Day','You Are Signed Out')
self.sign_in.destroy()
sign_out=Button(self.sign_in,anchor='ne',text='Sign Out',command=sign_out)
sign_out.pack(side='right')
sign_out.place(x=620,y=5)
fh=open('fh.txt','r+')
_row=0
ct =1
for i in range(len(fh.readlines())):
Label(self.sign_in, text=fh.readlines[i], width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)

t=after_sign_in()









share|improve this question















from tkinter import *
from tkinter import messagebox

class after_sign_in(object):
def __init__(self):
self.sign_in_after()
def sign_in_after(self):
self.sign_in=Tk()
self.sign_in.geometry('700x300')
self.sign_in.maxsize(height=300,width=700)
self.sign_in.title('Account')
def sign_out():
messagebox.showinfo('Have A Nice Day','You Are Signed Out')
self.sign_in.destroy()
sign_out=Button(self.sign_in,anchor='ne',text='Sign Out',command=sign_out)
sign_out.pack(side='right')
sign_out.place(x=620,y=5)
fh=open('fh.txt','r+')
_row=0
ct =1
for i in range(len(fh.readlines())):
Label(self.sign_in, text=fh.readlines[i], width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)

t=after_sign_in()






python-3.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 12:53









L3viathan

14.8k12647




14.8k12647










asked Nov 9 at 12:51









Himanshu Mishra

6




6




closed as off-topic by tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja Nov 9 at 14:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja

If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja Nov 9 at 14:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – tharkay, Mark Rotteveel, Tom Toms, GhostCat, stealthyninja

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1




    Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
    – UnholySheep
    Nov 9 at 12:52














  • 1




    Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
    – UnholySheep
    Nov 9 at 12:52








1




1




Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
– UnholySheep
Nov 9 at 12:52




Please fix the formatting, this is absolutely unreadable. And also indicate which line exactly throws the error
– UnholySheep
Nov 9 at 12:52












1 Answer
1






active

oldest

votes

















up vote
1
down vote













The problem is here:



text=fh.readlines[i]


fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



for i, line in enumerate(fh):
Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)





share|improve this answer




























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    The problem is here:



    text=fh.readlines[i]


    fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



    I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



    for i, line in enumerate(fh):
    Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
    Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)





    share|improve this answer

























      up vote
      1
      down vote













      The problem is here:



      text=fh.readlines[i]


      fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



      I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



      for i, line in enumerate(fh):
      Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
      Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)





      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        The problem is here:



        text=fh.readlines[i]


        fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



        I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



        for i, line in enumerate(fh):
        Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
        Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)





        share|improve this answer












        The problem is here:



        text=fh.readlines[i]


        fh.readlines is a function that you would need to call first — ideally only once. Iterating over range(len(...)) is almost always useless and can be done easier.



        I suggest iterating over the file handle directly (as you don't really need the list of lines. Since you still need the index i, you can use enumerate:



        for i, line in enumerate(fh):
        Label(self.sign_in, text=line, width=22, anchor='center',padx=5,pady=5 ).grid(row=i,column=1)
        Label(self.sign_in, text=str(ct), width=22, anchor='center',padx=5,pady=5 ).grid(row=i+1)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 12:55









        L3viathan

        14.8k12647




        14.8k12647















            QT3IHP6UNejRs ffIwo H6RlNmuT9JBNYY5KVjg64sz0cB0A0tPzzQYbqcV2pW9b6X8VuY,qX3g40Ke25Ejec7lb50Lvj4,uO9eC h
            MdnyY64kt0286GHWF3ybUxifWrU2qIxCU

            Popular posts from this blog

            How to pass form data using jquery Ajax to insert data in database?

            Guess what letter conforming each word

            Run scheduled task as local user group (not BUILTIN)