如何在kivy中创建条件文本标签 例如,如果x = 1文本=“ Hi”,如果x = 2文本=“ Hello”,如果x = 1文本=“ helloword”
[Route("api/[controller]")]
[EnableCors("AllowAllOrigin")]
[ApiController]
public class HomeController : ControllerBase
{
private readonly DataBaseContext _dbContext;
private readonly MyClass _myClass
public HomeController (DataBaseContext dbContext, MyClass myClass)
{
_dbContext = dbContext;
_myClass = myClass;
}
[EnableCors("AllowAllOrigin")]
[HttpPost("[action]")]
public async Task<string> UpdateBotSettings()
{
await _myClass.AnyMethod();
// rest of codes
}
}
类似的东西
答案 0 :(得分:1)
text:
之后的部分是Python语法(不是特定于基维的):
text:'hi' if root.x=='1' else 'hello' if root.x=='2' else 'helloworls'