如何在猕猴桃按钮旁边添加标签?

时间:2019-05-31 15:42:37

标签: python kivy

我如何在按钮旁边添加标签文本?

我使用主页图标作为按钮,我想在说“ HOME”的旁边添加标签

1 个答案:

答案 0 :(得分:0)

使用public int CreateTransactionScope(string connectString1, SqlCredential creds , string commandText1) { // Initialize the return value to zero and create a StringWriter to display results. int returnValue = 0; System.IO.StringWriter writer = new System.IO.StringWriter(); try { // Create the TransactionScope to execute the commands, guaranteeing // that both commands can commit or roll back as a single unit of work. using (TransactionScope scope = new TransactionScope()) { using (SqlConnection connection1 = new SqlConnection(connectString1,creds)) { // Opening the connection automatically enlists it in the // TransactionScope as a lightweight transaction. connection1.Open(); // Create the SqlCommand object and execute the first command. SqlCommand command1 = new SqlCommand(commandText1, connection1); returnValue = command1.ExecuteNonQuery(); writer.WriteLine("Rows to be affected by command1: {0}", returnValue); } using (SqlConnection connection2 = new SqlConnection(connectString1, creds)) { // Opening the connection automatically enlists it in the // TransactionScope as a lightweight transaction. connection2.Open(); // Create the SqlCommand object and execute the first command. SqlCommand command1 = new SqlCommand(commandText1, connection2); returnValue = command1.ExecuteNonQuery(); writer.WriteLine("Rows to be affected by command1: {0}", returnValue); } // The Complete method commits the transaction. If an exception has been thrown, // Complete is not called and the transaction is rolled back. scope.Complete(); } } catch (TransactionAbortedException ex) { writer.WriteLine("TransactionAbortedException Message: {0}", ex.Message); } // Display messages. Console.WriteLine(writer.ToString()); return returnValue; } BoxLayout,并将GridLayout设置为size_hint_x,并将None设置为width和{{ 1}}。

示例

以下示例说明了如何使用Label和KivyMD Button

main.py

GridLayout

输出

Result