0
$\begingroup$

i was trying script a button in 2.8 i stared withe the templates UI panel

but i wanted to place in the top bar which error out if i change the layout is there any way to place the button in the top bar?enter image description here

$\endgroup$
1
$\begingroup$

Pre or Append to the header.

With all panels and headers in blender you can append or prepend a draw method to them.

enter image description here

Test script prepends a splash screen button to topbar

import bpy

def draw(self, context):
    self.layout.operator("wm.splash")

bpy.types.TOPBAR_HT_upper_bar.prepend(draw)

To find the class to "leach" onto, with developer extras on, right click and view source. With the naming convention, TOPBAR pretty self explanatory, HT it's a header type. Hence using autocomplete in python console is a way to find contenders

$\endgroup$
  • $\begingroup$ thanks i'll try and see if it works $\endgroup$ – sumukha bhasri Aug 9 '19 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.