这是我的代码,我想要做的是在框架中间设置网址标签,在其旁边设置条目文字,并在网址和输入文字字段下方添加3个按钮。
<div id="ms-preload" class="ms-preload">
<div id="status">
<div class="spinner">
<div class="dot1"></div>
<div class="dot2"></div>
</div>
</div>
</div>
<div class="bg-full-page bg-primary back-fixed">
<div class="md-500 absolute-center">
<div class="col-lg-10 col-md-offset-1">
<div class="card">
<div class="card-block">
<<h1 class="color-primary text-big">Let's Add User</h1>
<div class="col-md-2">
<div class="row ">
<button class="btn btn-raised btn-primary btn-block " id="clone_button">
+ <i class="zmdi zmdi-account"></i></button>
</div>
</div>
<form>
<fieldset>
<div id="clone_wrapper">
<div class="col-md-3 form-line">
<div class="form-group">
<label for="select111" class="col-md-2 control-label">Role</label>
<div class="col-md-10">
<select id="select111" class="form-control selectpicker" data-dropup-auto="false">
<option>Ea nam qui vel consequatur</option>
<option>Dolorem perspiciatis adipisci </option>
<option>Aperiam, debitis deleniti</option>
<option>Accusamus non qui amet eum</option>
<option>Doloremque commodi impedit</option>
</select>
</div>
</div>
</div>
<div class="col-md-2 form-line">
<div class="form-group label-floating">
<div class="input-group">
<label class="control-label" for="ms-form-user">First Name</label>
<input type="text" id="ms-form-user" class="form-control"> </div>
</div>
</div>
<div class="col-md-2 form-line">
<div class="form-group label-floating">
<div class="input-group">
<label class="control-label" for="ms-form-pass">Last Name</label>
<input type="password" id="ms-form-pass" class="form-control"> </div>
</div>
</div>
<div class="col-md-2 form-line">
<div class="form-group label-floating">
<div class="input-group">
<label class="control-label" for="ms-form-pass">Email</label>
<input type="password" id="ms-form-pass" class="form-control"> </div>
</div>
</div>
<div class="col-md-2 form-line">
<div class="form-group">
<label for="select111" class="col-md-2 control-label">Profile</label>
<div class="col-md-2">
<select id="select111" class="form-control selectpicker" data-dropup-auto="false">
<option>Ea nam qui vel consequatur</option>
<option>Dolorem perspiciatis adipisci </option>
<option>Aperiam, debitis deleniti</option>
<option>Accusamus non qui amet eum</option>
<option>Doloremque commodi impedit</option>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row ">
<div class="col-md-5 form-line">
<button class="btn btn-raised btn-block">back</button>
</div>
<div class="col-md-5 form-line">
<button class="btn btn-raised btn-primary btn-block">Done</button>
</div>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
如果您坚持使用.grid()
方法,则可以将以下内容添加到您的代码中:
for column in range(10):
Grid.columnconfigure(root, column, weight=1)
for row in range(10):
Grid.rowconfigure(root, row, weight=1)
这意味着网格的列和行将在窗口中可用的空间均匀分配给它们。将此与sticky
的{{1}}属性结合使用可以让您获得所需的结果。
但是,从主观上讲,您可能更容易切换到.grid()
方法,至少在我看来,这样可以更轻松地配置和管理tkinter GUI。
您可以执行以下操作:
.pack()
以上内容使用了很多不同的新想法,这些想法已在Stack Overflow上被多次询问和回答,因此我将把您链接到this fantastic answer from Bryan Oakley。