logo
down
shadow

How to group two sets of buttons on each top corner of the screen using Tkinter?


How to group two sets of buttons on each top corner of the screen using Tkinter?

By : Aaron Chuidian
Date : October 23 2020, 08:10 PM
Hope this helps It will be much better if you use grid() geometry manager as you have much finer control over your positioning of widgets. With pack() you can mess up things pretty easily. Note that I have drawn the borders for you to realise that I have changed things a bit. You can see the Frames clearly in the picture.
code :
import tkinter as tk
from tkinter import messagebox

win = tk.Tk()
width_value = win.winfo_screenwidth()
height_value = win.winfo_screenheight()
win.geometry(f"{width_value}x{height_value}+0+0")
win.resizable(False, True)
win.title("Test GUI")

win.grid_columnconfigure(0, weight=1)
win.grid_columnconfigure(1, weight=1)

topLeftFrame = tk.Frame(win, relief='solid', bd=2)
topLeftFrame.grid(row=0, column=0, padx=10, sticky="w")

homeImg = tk.PhotoImage(file="ex1.png")
homeb = tk.Button(topLeftFrame, image=homeImg, height=100, width=100).grid(row=0, column=0, padx=10, pady=10)

rgbmenuImg = tk.PhotoImage(file="ex1.png")
rgbmenub = tk.Button(topLeftFrame, image=rgbmenuImg, height=100, width=100)

thermalmenuImg = tk.PhotoImage(file="ex1.png")
cameraImg = tk.PhotoImage(file="ex1.png")
thermalmenub = tk.Button(topLeftFrame, image=thermalmenuImg, height=100, width=100)

rgbmenub.grid(row=0, column=1, padx=10, pady=10)
thermalmenub.grid(row=0, column=2, padx=10, pady=10)

topRightFrame = tk.Frame(win, relief='solid', bd=2)
topRightFrame.grid(row=0, column=1, padx=10, sticky="e")

settImg = tk.PhotoImage(file="ex1.png")
settingb = tk.Button(topRightFrame, image=settImg, height=100, width=100)

infoImg = tk.PhotoImage(file="ex1.png")
infob = tk.Button(topRightFrame, image=infoImg, height=100, width=100)

loginImg = tk.PhotoImage(file="ex1.png")
loginb = tk.Button(topRightFrame, image=loginImg, height=100, width=100)

settingb.grid(row=0, column=0, padx=10, pady=10)
infob.grid(row=0, column=1, padx=10, pady=10)
loginb.grid(row=0, column=2,padx=10, pady=10)

exitImg = tk.PhotoImage(file="ex1.png")
exitb = tk.Button(topRightFrame, image=exitImg, command=quit, height=100, width=100).grid(row=0, column=3, padx=10, pady=10)

leftFrame = tk.Frame(win, relief='solid', bd=2)
leftFrame.grid(row=1, column=0, padx=10, pady=10, sticky="nw")
tk.Button(leftFrame, text="Example 1").grid(row=1, column=0, pady=5)
tk.Button(leftFrame, text="Example 2").grid(row=2, column=0, pady=5)
tk.Button(leftFrame, text="Example 3").grid(row=3, column=0, pady=5)

rightFrame = tk.Frame(win, relief='solid', bd=2)
rightFrame.grid(row=1, column=1, padx=10, pady=10, sticky="ne")

dema = tk.Button(rightFrame, text="DEMA Intranet")
dema.grid(row=0, column=0, pady=5)
tk.Button(rightFrame, text="Example 4").grid(row=1, column=0, pady=5)
tk.Button(rightFrame, text="Example 5").grid(row=2, column=0, pady=5)
tk.Button(rightFrame, text="Example 6").grid(row=3, column=0, pady=5)

win.mainloop()


Share : facebook icon twitter icon
How to add buttons to the group box, and sets button.Text = item from table in SQL in run time mode

How to add buttons to the group box, and sets button.Text = item from table in SQL in run time mode


By : sanjeev
Date : March 29 2020, 07:55 AM
wish help you to fix your issue You can use the GroupBox.Controlls.Add() method to add new controls to it. Since you have to properly align them, I would first add a FlowLayoutPanel to the GroupBox (with Docking.Fill), which will float your Buttons (you can define vertical or horizontal flow and if the buttons should be wrapped or not when the width is reached). If you use a FlowLayoutPanel, you would add the buttons to the FlowLayoutPanel (using FlowLayoutPanel.Controlls.Add() and not directly to the GroupBox).
You can create a new Button as you would create a new object from any class (i.e. var btn = new Button()). The button text can be set to any string, so either your item is of type string or you need to use button.Text = item.Name (or any other representable string value in your item). You can specify the tag property of the button (e.g. button.Tag = item) to have a reference to the item behind the button. Finally, you can add an event handler to the button to capture when it is clicked by the user.
Unity2d buttons appears on the center of my phone screen . But i put them in the corner

Unity2d buttons appears on the center of my phone screen . But i put them in the corner


By : Swapneel Desai
Date : March 29 2020, 07:55 AM
Hope that helps You should change type of UIScaleMode to Scale With Screen Size in Canvas Scaler component. And then, change pivot of your buttons (if a button on the left bottom part of a screen, then pick LeftBottom and so on).
Python 3.5 Tkinter How to separate 2 sets of radio buttons

Python 3.5 Tkinter How to separate 2 sets of radio buttons


By : David Williams
Date : March 29 2020, 07:55 AM
seems to work fine You didn't bind two different variables to your button groups. Each Radiobutton group has to be associated with a single StringVar() or IntVar().
code :
v1 = tk.StringVar()
v2 = tk.StringVar()
# Group 1
s1r1=tk.Radiobutton(root,text="Red", variable=v1)
s1r2=tk.Radiobutton(root,text="Green", variable=v1)
s1r3=tk.Radiobutton(root,text="Blue", variable=v1)
# Group 2
s2r1=tk.Radiobutton(root,text="1", variable=v2)
s2r2=tk.Radiobutton(root,text="2", variable=v2)
s2r3=tk.Radiobutton(root,text="3", variable=v2)
Android set outline corner radius for custom radio buttons group

Android set outline corner radius for custom radio buttons group


By : Dileep Khan
Date : March 29 2020, 07:55 AM
With these it helps Use separate toggle layouts for left and right radio buttons. And then use shape layouts for each state. For example, For left, Use the following type of layout
code :
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="false" android:drawable="@drawable/radio_unselected_left" />
    <item android:state_checked="true" android:drawable="@drawable/radio_selected_left" />

</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_checked="false" android:drawable="@drawable/radio_unselected_right" />
    <item android:state_checked="true" android:drawable="@drawable/radio_selected_right" />

</selector>
Tkinter - bug that shows forgotten labels on corner of screen?

Tkinter - bug that shows forgotten labels on corner of screen?


By : Guillermo Bonino
Date : March 29 2020, 07:55 AM
will help you I was able to fix this issue by: Storing all labels in a dictionary with the key being something like ProductVariable + "_label" and the value would be the label
Storing all textvariables in the same dictionary. I had to change the label(root, text=..) to label(root, textvariable=..)
Related Posts Related Posts :
  • Submitting login form with scrapy
  • How do i edit the favicon in the Browsable API in Django REST framework?
  • multiprocessing.Pool.map_async doesn't seem to... do anything at all?
  • Python Selenium: Stale Element Reference Exception Error
  • Datetime conversion - How to extract the inferred format?
  • Import YAML variables automatically?
  • How to create a powershell shortcut for my python file
  • Python's 'set' operator doesn't work with numpy.nan
  • Pass object fields and one2many fields on same method - Odoo v8
  • Select columns based on column name and location in Pandas
  • Standardizing timeseries in Pandas using interpolation
  • How many tweets can be collected?
  • how format specifier taking value while tuple list is passed
  • How to print a numpy array with data type?
  • Timeout child thread for python3
  • How can I regroup a dataframe and accumulate a colume's values?
  • Bulk Insert into SQL Server with Python not working
  • Removing last rows of each group based on condition in a pandas dataframe
  • Why the css file can not be found in Django template?
  • targeting center of mass - scipy / numpy
  • Foursquare - get tips from VENUE_ID
  • Unpack a dictionary to format
  • encoding special characters in python2
  • Replacing integers with NaN results in the entire column becoming float dtype
  • Python 3.6 - BeautifulSoup4, parse table AttributeError: ResultSet object has no attribute 'findAll'
  • Convert panda date list to python list of date strings
  • escape response from Scrapy to parse json
  • How to create a same dropdown menu for different labels?
  • Why are some python variables uppercase whereas others are lowercase?
  • Machine Learning, What are the common techniques for feature engineering and presenting the model?
  • Modify value of a Django form field during clean() and validate again
  • Heroku Django app can't start up -- 'No module named site'
  • Getting list of dates (excluding weekends)
  • Im trying to create the regular expression to include the text and not the href
  • Python file.readline(2) reads first 2 charectars
  • Groupby with handling empty bin in python
  • Modifying Gcode
  • calling a value in a dictionary within a dictionary (reading a json file)
  • Bouncing ball invalid syntax why is that?
  • Python making a counter
  • Python rstrip and split
  • What does the String mean in numpy.r_?
  • How to correctly extend variable __all__ in a __init__.py?
  • Python behaves weird with piped input
  • Python 3 two dimensional list comprehension
  • How to slice image by broadcasting slices? Error: 'only integer scalar arrays can be converted to a scalar index' in pyt
  • (Python Beginner) Need a start on classes
  • IndexError: At least one sheet must be visible
  • How to solve a system of linear equations over the nonnegative integers?
  • Pandas keep the most complete rows
  • "List index out of range" error in Python Memory Match game
  • Numpy: how to use argmax results to get the actual max?
  • Google Cloud Dataflow can't import 'google.cloud.datastore'
  • Calculate pandas DataFrame column by custom routine which accepts dictionary as input
  • Connect to a Class Method by it's method name holded into a var in a for loop in python
  • PyQt5 signals and threading.Timer
  • Replace 2 characters in a string in python
  • Passing command line arguments from a folder script to a file script
  • Understand the syntaxe X[Y == c] in Numpy
  • Optimize beginner python script about substring replacement
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org