To create a blue button in python, you can use tkinter module to create a GUI application and then create a button with a blue color using the following code:
main.py343 chars20 lines
In the above code, we first import the tkinter module and create a GUI window using Tk()
method. Then we set the title and size of the window using title()
and geometry()
methods.
Next, we create a button widget using Button()
method and set its text to "Click me!" and background color as blue using the bg
attribute. We also set the foreground color as white using the fg
attribute.
Finally, we pack the button widget using pack()
method and run the GUI application using mainloop()
method.
gistlibby LogSnag