Thursday, April 25, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 12540  / 2 Years ago, mon, january 3, 2022, 11:41:56

I get this error:



Traceback (most recent call last):
File "bin/mybrowser", line 32, in <module>
import mybrowser
File "/home/shaunyo/mybrowser/mybrowser/__init__.py", line 14, in <module>
from mybrowser import MybrowserWindow
File "/home/shaunyo/mybrowser/mybrowser/MybrowserWindow.py", line 32
def on_refreshbutton_clicked(self, widget):
^
IndentationError: unindent does not match any outer indentation level


This is my code:



    self.refreshbutton = self.builder.get_object("refreshbutton")

def on_refreshbutton_clicked(self, widget):
print "refresh"


Does anyone know what's wrong?


More From » application-development

 Answers
6

I think you should have your code like



<TAB> self.refreshbutton = self.builder.get_object("refreshbutton")
<TAB> def on_refreshbutton_clicked(self, widget):
<TAB> print "refresh"


in your editor give a TAB everytime while entering in a new line.



Ok @Shaun



I think your code should look like



frank@FRANK-NATHE:~$ cat h.py
self.refreshbutton = self.builder.get_object("refreshbutton")
def on_refreshbutton_clicked(self, widget):
print "refresh"


so don't use a tab for the 1st and 2nd lines and then use a tab for the 3rd line



If you still get confused then



enter image description here


[#29679] Wednesday, January 5, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
reangi

Total Points: 213
Total Questions: 102
Total Answers: 114

Location: Namibia
Member since Wed, Jan 19, 2022
2 Years ago
;