Sublime Forum

EventListener on_load doesnt trigger when an image is opened

#1

Im trying to print the filename of any opened file when it loads. But on_load method doesnt trigger when an image is opened.

Is there any way to call a method when an image is opened? Using ST3 .Thanks.

def dosomething():
	print("hey")
	
class myOpener(sublime_plugin.EventListener):
	def on_load( self, view):
		print(view.file_name())
		dosomething()
	def on_new( self, view):
		print(view.file_name())
		dosomething()
	def on_clone( self, view):
		print(view.file_name())
		dosomething()
	def on_activated( self, view):
		print(view.file_name())
		dosomething()
0 Likes