如何更改标签小部件python tkinter中的文本大小

时间:2015-06-06 16:52:46

标签: python tkinter label

在使用Tkinter的python 3.4中,如何更改标签小部件中的文本大小?

到目前为止,我已经尝试了

label_one.config(fontsize='50')

<!DOCTYPE HTML> 
	<html>
		 <head> 
		 	<title>Sign-Up</title>
		 	<link rel="stylesheet" type="text/css" href="signup.css">
		  </head>
		  
		   <body id="body-color">
		   		 <div id="Sign-Up">
		   		 	 <fieldset style="width:30%">
		   		 	 <legend>Registration Form</legend>
		   		 	 <table border="0"> <tr> 
		   		 	 	<form method="post" action="signup.php">	 	 		   	
		   		 	 		 <td>Name</td>
		   		 	 	<td> <input type="text" name="name"></td> </tr> 
		   		 	 	<tr> <td>Email</td><td> <input type="text" name="email"></td> </tr>
		   		 	 	<tr> <td>UserName</td><td> <input type="text" name="user"></td> </tr> <tr>
		   		 	 		 <td>Password</td><td> <input type="password" name="pass"></td> </tr>
		   		 	 		  <tr> <td>Confirm Password </td><td><input type="password" name="cpass"></td> </tr>
		   		 	 		   <tr> <td><input id="button" type="submit" name="submit" value="Sign-Up"></td>
		   		 	 		   	 </tr>
		   		 	 		   	 
	  	  </table>
		 		   	   </fieldset> 
 				</div> 
   	   </body> 
 	   </html>

但我不知道从哪里开始,我找不到任何说法怎么做。

1 个答案:

答案 0 :(得分:34)

在创建标签时尝试传递width=200作为附加参数。

这应该可以用于创建指定宽度的标签。

如果您想稍后更改,可以使用:

label.config(width=200)

如果您想更改字体本身的大小,可以尝试:

label.config(font=("Courier", 44))
相关问题