Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Python

Vote on your favorite hash algorithm here!

Python Discussion forum for Python, a high-level language with simple syntax, but yet powerful.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-03-2007, 09:58 PM
mevets's Avatar   
mevets mevets is offline
Newbie
 
Join Date: Nov 2006
Posts: 11
Credits: 0
Rep Power: 0
mevets is on a distinguished road
Default Indention Error

I have tried moving clicked_btnApply above delete_event but I then get another error. Can anyone tell me where I have gone wrong?

I get a:
Code:
File "alarm.py", line 11
gtk.main_quit()

IndentationError: expected an indented block
Script:
Code:
#!/usr/bin/env python

# alarm.py

import pygtk
pygtk.require('2.0')
import gtk

class Clock:
   	def delete_event(self, widget, event, data=None):
        gtk.main_quit()
        return False
        
   	def clicked_btnApply(self, widget):
   		strDay = self.cmbDay.get_text()
   		print strDay
   		return False

    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("Alarm Clock")

        self.window.connect("delete_event", self.delete_event)

        self.window.set_border_width(10)

        vbox1 = gtk.VBox(False, 5)
        self.window.add(vbox1)
        vbox1.show()
        
        # make Snooze button
        btnSnooze = gtk.Button("Stop", gtk.STOCK_CANCEL)
        hboxSnooze = gtk.HBox(True, 0)
        hboxSnooze.pack_start(btnSnooze, True, True, 0)
        #vbox1.pack_start(hboxSnooze, True, True, 0)
        
        hboxSetTime = gtk.HBox(False, 0)
        vbox1.pack_start(hboxSetTime, True, True, 0)
        # make the day combobox
        cmbDay = gtk.combo_box_entry_new_text()
        cmbDay.append_text('Monday')
        cmbDay.append_text('Tuesday')
        cmbDay.append_text('Wednesday')
        cmbDay.append_text('Thursday')
        cmbDay.append_text('Friday')
        cmbDay.append_text('Saturday')
        cmbDay.append_text('Sunday')
        cmbDay.set_active(0)
        hboxSetTime.pack_start(cmbDay, False, False, 0)
        
        # make AM/PM toggle button
        togAM = gtk.ToggleButton("AM")
        togAM.set_active(True)
        hboxSetTime.pack_end(togAM, False, False, 0)
        
        # make minute spin button
        adjMins = gtk.Adjustment(30, 0, 59, 1, 0, 0)
        spinMins = gtk.SpinButton(adjMins, 0, 0)
        hboxSetTime.pack_end(spinMins, False, False, 0)
        
        hboxSetTime.pack_end(gtk.Label(":"), False, False, 0)
        
        # make hour spin button
        adjHour = gtk.Adjustment(7, 1, 12, 1, 0, 0)
        spinHour = gtk.SpinButton(adjHour, 0, 0)
        hboxSetTime.pack_end(spinHour, False, False, 0)
        
        # add a separator
        hsep = gtk.HSeparator()
        vbox1.pack_start(hsep, False, True, 0)
        
        # make a horizontal box for the close and apply buttons
        btnBox = gtk.HBox(False, 5)
        
        # make close button
        btnClose = gtk.Button("Close", gtk.STOCK_CLOSE)
        btnClose.connect("clicked", lambda wid: gtk.main_quit())
        btnBox.pack_end(btnClose, False, False, 0)
        
        # make apply button
        btnApply = gtk.Button("Apply", gtk.STOCK_APPLY)
        btnApply.connect("clicked", self.clicked_btnApply)
        btnBox.pack_end(btnApply, False, False, 0)
        vbox1.pack_start(btnBox, False, False, 0)
        
        self.window.show_all()
        #btnSnooze.hide()
        
        return

def main():
    gtk.main()
    return 0       

if __name__ == "__main__":
    Clock()
    main()
__________________
Steve M.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 10-03-2007, 10:13 PM
mevets's Avatar   
mevets mevets is offline
Newbie
 
Join Date: Nov 2006
Posts: 11
Credits: 0
Rep Power: 0
mevets is on a distinguished road
Default

I solved the problem, it looked fine in Geany but when I rewrote it, it was fixed. I figure it was a tabs vs. spaces problem but I cant say
__________________
Steve M.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Php error handling Jaan PHP Tutorials 3 09-07-2008 12:19 PM
VB6.0:Tutorial, Error handling TcM VB Tutorials 9 06-06-2008 01:31 PM
need urgent help finding parce error!!! siren C and C++ 3 09-13-2007 09:45 AM
Download problem, internal Server Error j3cubcapt ionFiles 1 07-02-2007 09:45 AM
can someone help me with my c librarys? bobwrit C and C++ 4 04-27-2007 06:19 PM


All times are GMT -5. The time now is 08:35 PM.

Contest Stats

Xav ........ 1357.94
MeTh0Dz|Reb0rn ........ 1075.89
WingedPanther ........ 919.18
marwex89 ........ 906.86
morefood2001 ........ 900.18
John ........ 890.77
Brandon W ........ 770.65
chili5 ........ 312.39
Steve.L ........ 264.99
dcs ........ 232.34

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 83%

Ads