<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Message: 6<br>
Date: Wed, 15 Apr 2009 14:18:18 -0400<br>
From: Steve McClure <<a href="mailto:sMcClure@racemi.com">sMcClure@racemi.com</a>><br>
Subject: Re: [pygtk] Funny Indent<br>
To: pygtk mailing list <<a href="mailto:pygtk@daa.com.au">pygtk@daa.com.au</a>><br>
Message-ID: <<a href="mailto:4B20E162-807E-435C-A8EF-B0559D6AECEF@racemi.com">4B20E162-807E-435C-A8EF-B0559D6AECEF@racemi.com</a>><br>
Content-Type: text/plain; charset="us-ascii"<br>
<br>
<br>
On Apr 15, 2009, at 1:57 PM, Nawal Husnoo wrote:<br>
<br>
> Dear PyGTK users,<br>
><br>
> I have never used PyGTK, and I only wanted to extract some gstreamer<br>
> webcam code from a script I found on:<br>
><br>
> <a href="http://giss.tv/wiki/index.php/Streaming_Tools#GStreamer_2" target="_blank">http://giss.tv/wiki/index.php/Streaming_Tools#GStreamer_2</a><br>
><br>
><br>
> I have removed most of the codes I don't need, but I'm puzzled by<br>
> the indentation used:<br>
><br>
> class GTK_Main:<br>
><br>
> def __init__(self):<br>
> window = gtk.Window(gtk.WINDOW_TOPLEVEL)<br>
> window.set_title("Webcam Streamer")<br>
> window.set_default_size(1024, 768)<br>
><br>
> window.connect("destroy", gtk.main_quit, "WM destroy")<br>
> self.sstate = 'preparing'<br>
> <<<<======================================<br>
><br>
> red=gtk.gdk.color_parse('grey')<br>
> eb=gtk.EventBox()<br>
> eb.modify_bg(gtk.STATE_NORMAL, red)<br>
> window.add(eb)<br>
><br>
> windows = gtk.ScrolledWindow()<br>
> windows.set_size_request(600, 400)<br>
> eb.add(windows)<br>
><br>
><br>
> Could anyone tell me if this has something to do with PyGTK itself<br>
> or if it's something deeper in Python? If I remove the "extra"<br>
> indent, and run the code, it gives this error:<br>
><br>
> File "./Webcamstream-v4l2.pys", line 29<br>
> red=gtk.gdk.color_parse('grey')<br>
> ^<br>
> IndentationError: unexpected indent<br>
><br>
><br>
> If I remove the indent in all 5 indented lines, it complains in the<br>
> same way with the next one:<br>
><br>
> File "./Webcamstream-v4l2.pys", line 34<br>
> windows = gtk.ScrolledWindow()<br>
> ^<br>
> IndentationError: unexpected indent<br>
><br>
> Any ideas?<br>
<br>
Your .pys file has mixed tabs and spaces. If by "remove the indent in<br>
all 5 indented lines" you actually replaced the spaces with tabs, I<br>
think you would find the code worked as expected. It looks like the<br>
tab spacing is expected to be 8 here.<br>
</blockquote></div><br>Yes, that worked great, thank you very much!<br clear="all"><br>-- <br>The best way to predict the future is to invent it. - Alan Kay<br><a href="http://www.galileon.co.uk/">http://www.galileon.co.uk/</a><br>