from epyk.core.Page import Report
rptObj = Report()
button = rptObj.ui.button("Test")
rptObj.outs.jupyter()
It is also possible to change the style of it by using any CSS properties.
Those will be automatically added to the CSS inline property of the contrainer. For complex components (not structure with only one HTML tag) it is important to keep in mind that this will only impact the container.
from epyk.core.Page import Report
rptObj = Report()
button = rptObj.ui.button("Test")
button.style.css.color = 'red' # This will change the color
button.style.css.background = 'yellow'
rptObj.outs.jupyter()
More advance styling options are available.
For example if it possible to add style only when th emouse will be on the component. In order to do this the property style will allow you to add the CSS style.
Behind the scene this will swtich the inline CSS to a dedicated CSS class with hover properties. In this case the interface is a bit different and it is using a dictionary.
from epyk.core.Page import Report
rptObj = Report()
button = rptObj.ui.button("Test")
button.style.hover({'color': 'red', 'background': 'yellow'})
rptObj.outs.jupyter()
This structure for CSS Style can be quite useful and an entry point is also available in the component itself to allow dictionary for inline CSS. This structure is similar to JQuery.
This could allow you to keep all the configuration in a dedicated file.
rptObj = Report()
button = rptObj.ui.button("Test")
button.css({'color': 'red', 'background': 'yellow'})
rptObj.outs.jupyter()
Other flavours of buttons are available from the property buttons.
from epyk.core.Page import Report
rptObj = Report()
rptObj.ui.buttons.important("Important")
rptObj.ui.buttons.validate()
rptObj.ui.buttons.remove()
rptObj.outs.jupyter()
It is obviously possible to add any kind of event to a button.
The usual one is the click event btu all the different events are possible from the on() event. More details are available in the Javascript section
from epyk.core.Page import Report
rptObj = Report()
button = rptObj.ui.button("Test")
button.click([
rptObj.js.alert('This is an alert !')
])
rptObj.outs.jupyter()
Also any help is more than welcome !