2017-05-31 16 views
0

私はこれらのチェックボタンをtkinterにどのように合わせるか、質問したいと思います。私はttkを使っています。 Checkbuttons, that I want to align to the LEFTこれらのチェックボタンをtkinterに揃える方法は?

これは、私を助けてください私のコード

button_frame=Frame(main, style='TFrame') 
checks_frame=Frame(main, style='TFrame') 
output_frame=Frame(main, style='TFrame') 
start_button=Button(button_frame, text='START', command=lambda: _thread.start_new_thread(suspend_processes,()), state=NORMAL, style='TButton') 
stop_button=Button(button_frame, text='STOP', command=lambda: restore_all_processes(False, False), state=DISABLED, style='TButton') 
restore_button=Button(button_frame, text='RESTORE', command=lambda: restore_all_processes(False, True), style='TButton') 
scrollbar=Scrollbar(output_frame) 
out=Text(output_frame, state=NORMAL, bg='white', width=50, height=10, spacing3=True, wrap=WORD, yscrollcommand=scrollbar.set, font=('Calibri'), foreground=theme) 
strict_check=Checkbutton(checks_frame, text='Strict mode (FPS+)', variable=strict, command=switch_strict, style='TCheckbutton') 
real_time_check=Checkbutton(checks_frame, text='Use real time priority (experimental, sound may lagg, FPS+)', state=NORMAL, command=switch_real_time, variable=real_time) 
dis_game_sound_check=Checkbutton(checks_frame, text='Disable in game sound (recommended, FPS+)', state=DISABLED, command=switch_dis_game_sound, variable=dis_game_sound) 
dis_grass_swaying_check=Checkbutton(checks_frame, text='Disable grass swaying (FPS+)', variable=dis_grass_swaying) 
dis_per_pixel_point_lighting_check=Checkbutton(checks_frame, text='Disable per pixel point lighting (FPS+)', variable=dis_per_pixel_point_lighting) 
slow_client_check=Checkbutton(checks_frame, text='Slow Client (max performance for client)', variable=slow_client) 

button_frame      .pack() 
start_button      .pack(side=LEFT) 
stop_button      .pack(side=LEFT) 
restore_button     .pack(side=LEFT) 
checks_frame      .pack(side=LEFT) 
dis_per_pixel_point_lighting_check.pack() 
dis_grass_swaying_check   .pack() 
slow_client_check     .pack() 
strict_check      .pack() 
real_time_check     .pack() 
dis_game_sound_check    .pack() 
output_frame      .pack(side=RIGHT) 
out        .pack(side=LEFT, fill=BOTH, expand=True) 
scrollbar       .pack(side=LEFT, expand=True, fill=Y) 

です。すべての応答ありがとう。

+2

あなたは無関係なコードを投稿しました。あなたはそれを[mcve]に減らすことができますか?また、checkbuttonsとpackのドキュメントを参照して、利用可能なオプションを確認してください。あなたが聞いた質問は、利用可能なドキュメントを読んで、少し実験をして答えられます。 –

+0

http://effbot.org/tkinterbook/pack.htm –

+1

を参照してください。['grid()'](http://effbot.org/tkinterbook/grid.htm)を 'pack () '? – Anthony

答えて

2

パックアンカーアトリビュートを各チェックボタンウィジェットに設定する必要があると思います。デフォルトのアンカーは 'center'です。そのため、コンテナの中心に配置されています。だからここに修正があります。

dis_per_pixel_point_lighting_check.pack(side=TOP, anchor=W) 
dis_grass_swaying_check   .pack(side=TOP, anchor=W) 
slow_client_check     .pack(side=TOP, anchor=W) 
strict_check      .pack(side=TOP, anchor=W) 
real_time_check     .pack(side=TOP, anchor=W) 
dis_game_sound_check    .pack(side=TOP, anchor=W) 
+0

例はこの回答の質を改善します。 – scotty3785

関連する問題