File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 11import { Widget } from '@lumino/widgets' ;
2- import { MainAreaWidget } from '@jupyterlab/apputils' ;
2+ import {
3+ MainAreaWidget ,
4+ ToolbarButton ,
5+ } from '@jupyterlab/apputils' ;
36import {
47 imageIcon ,
8+ refreshIcon ,
59} from '@jupyterlab/ui-components' ;
610
711import { requestAPI } from './request' ;
@@ -60,5 +64,15 @@ export class ImageCaptionMainAreaWidget extends MainAreaWidget<ImageCaptionWidge
6064 this . title . label = 'Random image with caption' ;
6165 this . title . caption = this . title . label ;
6266 this . title . icon = imageIcon ;
67+
68+ // Add a refresh button to the toolbar
69+ const refreshButton = new ToolbarButton ( {
70+ icon : refreshIcon ,
71+ tooltip : 'Refresh image' ,
72+ onClick : ( ) => {
73+ widget . load_image ( ) ;
74+ }
75+ } ) ;
76+ this . toolbar . addItem ( 'refresh' , refreshButton ) ;
6377 }
6478}
You can’t perform that action at this time.
0 commit comments