这是图像的一部分。
from tkinter import *
class Application(Frame):
"""GUI application which counts button clicks."""
def __init__(self, master):
super(Application, self).__init__(master)
self.grid()
self.bttn_clicks = 0
self.create_widget()
def create_widget(self):
""" Create buttong that displays the number of clicks. """
self.bttn = Button(self)
self.bttn["text"]= "Total Clicks: 0"
self.bttn["command"] = self.update_count
self.bttn.grid()
def update_count(self):
""" Increase click count and display new total. """
self.bttn_clicks += 1
self.bttn["text"] = "Total Clicks: " + str(self.bttn_clicks)
#main
root = Tk()
root.title("Click Counter")
root.geometry("300x115")
app = Application(root)
任何想法我怎么能这样做?
答案 0 :(得分:0)
您将比背景图像规则更多地使用背景规则。通过简写,您将能够控制其背景颜色,如果由于没有互联网连接而无法加载图像,并且您还可以控制您希望图像重复与否,滚动或保持固定等等。
试试这个:
.wrapper {
background:url('http://www.intrawallpaper.com/static/images/gradient-background.jpg') center center no-repeat fixed;
background-size: cover;
}