Пример #1
0
class MainWindow:

	def __init__(self,db,pages):
		self.window= gtk.Window(gtk.WINDOW_TOPLEVEL)
		self.window.connect('destroy',self.destroy)

		self.db= db
		self.log= LogText()

		self.frames= []
		self.tab_labels= []
		self.notebook= gtk.Notebook()
		for page in pages:
			self.frames.append( WikiText(self,page) )
			self.frames[-1].text.show()
			self.tab_labels.append( gtk.Label(page.word) )
			self.tab_labels[-1].show()
			scrolled= gtk.ScrolledWindow()
			scrolled.add( self.frames[-1].text )
			self.notebook.append_page(scrolled,self.tab_labels[-1])
			scrolled.show()
#			self.frames[-1].test_tags()
		
		scrolled= gtk.ScrolledWindow()
		scrolled.add( self.log.text )
		self.log.text.show()
		label= gtk.Label('Log')
		label.show()
		self.notebook.append_page(scrolled,label)
		scrolled.show()
		
		self.button= gtk.Button('acme')
		self.button.connect("clicked",self.clicked,'dummy data')
		
		self.window.add(self.notebook)
		self.notebook.show()
		self.window.show()
		self.window.resize(800,600)
		#self.window.set_border_width(5)
		
		
	def clicked(self,widget,data=None):
		print 'button clicked'
		
	def destroy(self,widget,data=None):
		self.log.restore()
		gtk.main_quit()
		
	def main(self):
		gtk.main()
Пример #2
0
	def __init__(self,db,pages):
		self.window= gtk.Window(gtk.WINDOW_TOPLEVEL)
		self.window.connect('destroy',self.destroy)

		self.db= db
		self.log= LogText()

		self.frames= []
		self.tab_labels= []
		self.notebook= gtk.Notebook()
		for page in pages:
			self.frames.append( WikiText(self,page) )
			self.frames[-1].text.show()
			self.tab_labels.append( gtk.Label(page.word) )
			self.tab_labels[-1].show()
			scrolled= gtk.ScrolledWindow()
			scrolled.add( self.frames[-1].text )
			self.notebook.append_page(scrolled,self.tab_labels[-1])
			scrolled.show()
#			self.frames[-1].test_tags()
		
		scrolled= gtk.ScrolledWindow()
		scrolled.add( self.log.text )
		self.log.text.show()
		label= gtk.Label('Log')
		label.show()
		self.notebook.append_page(scrolled,label)
		scrolled.show()
		
		self.button= gtk.Button('acme')
		self.button.connect("clicked",self.clicked,'dummy data')
		
		self.window.add(self.notebook)
		self.notebook.show()
		self.window.show()
		self.window.resize(800,600)