I'm trying to script an Add-on that lets user to choose .txt file from some directory by pressing a button from panel and read data in that .txt file. This is what I tried
bl_info = {
"name": "Simple Add-on Template",
"author": "Chris Conlan",
"location": "View3D > Tools > Simple Addon",
"version": (1, 0, 0),
"blender": (2, 8, 0),
"description": "Starting point for new add-ons.",
"wiki_url": "http://example.com",
"category": "Development"
}
import bpy
class ImportPanel(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "Import"
bl_label = "File Import"
def draw(self, context):
layout = self.layout
row = layout.row()
row.label(text="Import", icon='HAND')
row.operator("file.filepath_drop", text = "Imp")
def register():
bpy.utils.register_class(ImportPanel)
def unregister():
bpy.utils.unregister_class(ImportPanel)
if __name__ == "__main__":
register()
But this is not working as though. Output I expected from above code is It should create a 'choose file' button that lets me to choose a txt file from file system.