我有这段代码将创建一个简单的复选框:
from Tkinter import *
CheckVar = IntVar()
self.checkbutton = Checkbutton(self.root, text = "Test", variable = CheckVar)
Run Code Online (Sandbox Code Playgroud)
但是,默认情况下取消选中此复选框,我正在搜索检查它的方法.
到目前为止,我试图插入
CheckVar.set(1)
Run Code Online (Sandbox Code Playgroud)
就在CheckVar之后但它没有用.
谢谢你的帮助
编辑:这是我的完整代码.当我运行它时,该框仍未选中
from Tkinter import *
class App():
def __init__(self, root):
self.root = root
CheckVar = IntVar()
CheckVar.set(1)
self.checkbutton = Checkbutton(self.root, text = "Test", variable = CheckVar)
self.checkbutton.grid(row=0, column=0,)
root = Tk()
app = App(root)
root.mainloop()
Run Code Online (Sandbox Code Playgroud) 我希望所有链接在访问时都会改变颜色.我正在使用Bootstrap,这是我到目前为止所尝试的(这不能正常工作):
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="unicode">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" type="text/css" rel="stylesheet">
<style type="text/css">
a{
color:#d99a30 !important;
&:hover{ color:#37404e !important;}
&:visited{ color:#37404e !important;}
}
</style>
</head>
<body>
<div class="container">
<div class="col-md-8 col-md-offset-2">
<div class="row">
<div class="col-sm-12">
<h3><a href="some_link.html">Link</a></h3>
</div>
</div>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助