Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I put a comment in between a line of code in python without commenting the whole line? [duplicate]

I am using thonny now but I wanted to know in general that can I comment in between a line of code in python

from tkinter import *
root=Tk()

mybutton=Button(root,text="click Help",state=DISABLED,padx=60,pady=55) 
mybutton.pack()
root.mainloop()                                                                                    

I wanted to comment state=disabled here but not the entire line. So can I do it or I have to write a new line for it. :)

like image 526
Universe A7 Avatar asked Dec 21 '25 20:12

Universe A7


1 Answers

You can put the arguments on multiple lines, then comment the one you don't want:

from tkinter import *
root=Tk()

mybutton = Button(
    root,
    text="click Help",
    #state=DISABLED,
    padx=60,
    pady=55
) 
mybutton.pack()
root.mainloop()                                                                                    
like image 64
Xiddoc Avatar answered Dec 23 '25 09:12

Xiddoc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!