logo
Tags down

shadow

Python 3: Positions of button and input text in a text box


By : user2175128
Date : October 16 2020, 08:10 AM
Hope this helps The usual way to build complex layouts is to group associated widgets together with frames. In the example below I'm grouping the entrys in one frame and the button in another. This makes it easier to control the vertical positioning.
code :
from tkinter import *
root = Tk()

top = Frame(root)   # Create frame to hold entrys
top.pack()          # Pack top frame
l1 = Label(top, text="Variable_1")
l1.pack(side=LEFT)
e1 = Entry(top, bd=5)
e1.pack(side=LEFT)

l2 = Label(top, text="Variable_2")
l2.pack(side=LEFT)
e2 = Entry(top, bd=5)
e2.pack(side=LEFT)

l = Label(root)
def callback():
    x = e1.get()
    y = e2.get()
    print(x)
    print(y)

bottom = Frame(root)    # Create frame to hold button
bottom.pack()           # Pack bottom frame
b = Button(bottom, text="OK", command=callback)
b.pack()


Share : facebook icon twitter icon

How to vertically align button, text and input text field in TD using Twitter Bootstrap


By : Max
Date : March 29 2020, 07:55 AM
To fix this issue Twitter bootstrap will add a margin-bottom: 10px to most form elements, but not to the

How to stretch an input button to available width and center it's text using CSS padding and text-indent?


By : Chris Lane
Date : March 29 2020, 07:55 AM
I wish this help you There is no way to achieve this while using a fixed width. If you are open to adjusting the width the following styling will work. The important parts are display:block, width:100%, text-align:center.
code :
.icon_text {
    border: 1px solid #aaa;
    border-radius: .7em;
    -moz-border-radius: .7em;
    -webkit-border-radius: .7em;
    color: white !important;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    background-color: #7EB238;
    background-image: url("p.png");
    background-image: url("p.png"), -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(rgba(52,109,28,1)), color-stop(rgba(52,109,28,0) )), -webkit-gradient(linear, left top, left bottom, from( #9ad945 ), to( #7eb238 )); 
    background-image: url("p.png"), -webkit-radial-gradient(center, ellipse cover,  rgba(52,109,28,1), rgba(52,109,28,0) ), -webkit-linear-gradient( #9ad945, #7eb238 ); 
    background-image: url("p.png"), -moz-radial-gradient(center, ellipse cover, rgba(52,109,28,1), rgba(52,109,28,0) ), -moz-linear-gradient( #9ad945, #7eb238 ); 
    background-image: url("p.png"), -ms-radial-gradient(center, ellipse cover, rgba(52,109,28,1), rgba(52,109,28,0) ), -ms-linear-gradient( #9ad945, #7eb238 ); 
    background-image: url("p.png"), -o-radial-gradient(center, ellipse cover, rgba(52,109,28,1), rgba(52,109,28,0) ), -o-linear-gradient( #9ad945, #7eb238 ); 
    background-image: url("p.png"), radial-gradient(ellipse at center, rgba(52,109,28,1) 67%, rgba(52,109,28,0) 69%), linear-gradient( #9ad945, #7eb238 );
    background-attachment: scroll, scroll, scroll;
    background-repeat: no-repeat, no-repeat, no-repeat;
    background-position: -100px 50%, 7px 50%, center center;
    background-size: 864px 18px, 20px 20px, auto auto;
    -webkit-background-size: 864px 18px, 20px 20px, auto auto;
    background-clip: content-box, content-box, padding-box;
    -webkit-box-sizing: content-box; 
    -moz-box-sizing: content-box;   
    box-sizing: content-box;
    text-indent: 2.1em;
    padding-top: 6px;
    padding-bottom:7px;
    padding-left: 7px;
    padding-right:92px;
    height: 20px;
    display: block;
    width: 100%;
    text-align: center;
}

display text and button in proper positions using css


By : Anup Sahoo
Date : March 29 2020, 07:55 AM
may help you . visit link1 , Its fine. But visit link2 Some problems are there ,
1> height is the issue; use this
code :
.product-view .product-essential .product-shop .price-box {
    padding-bottom: 0 !important;
    height: 75px;
}
.Quick .You_savee {
    border: 1px solid #ccc;
    border-radius: 37px;
    color: green;
    left: 151px;
    padding: 0;
    position: relative !important;
    top: -70px !important;
    width: 49px;
}

how to make text input and button the same height when assigning the text input fixed font-size?


By : Cedric Fridgren
Date : March 29 2020, 07:55 AM
To fix the issue you can do , Flexbox can do that:
code :
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
form {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
}
form input {
  width: 90%;
  font-size: 50px;
}
form button {
  width: 9%;
}
<form>
  <input id="m" type="text">
  <button>POST</button>
</form>

Python - Kivy - Screen Manager - Changing a Button Text with Text Input issue


By : Reuven
Date : March 29 2020, 07:55 AM
With these it helps I'm currently working with Kivy for GUI Design I was looking for a way to change a button text with a TextInput from another screen. , Please replace the following in screen3.kv:
code :
        on_press: app.root.inch_input.text = entry.text
        on_press: root.manager.ids.tire_setup_screen_id.ids.inch_input.text = entry.text
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition

from kivy.uix.label import Label
from kivy.uix.widget import Widget
from kivy.graphics import Line

from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput


class Main_Screen(Screen):
    pass


class Input_Number_Inch_Screen(Screen):
    pass


class Input_Screen(Screen):
    pass


class Screen_Management(ScreenManager):
    pass


presentation = Builder.load_file("screen3.kv")


class Screen3App(App):

    def build(self):
        return presentation


if __name__ == "__main__":
    Screen3App().run()
#:kivy 1.10.0
#:import FadeTransition kivy.uix.screenmanager.FadeTransition

Screen_Management:
    id: screen_management
    transition: FadeTransition()
    Main_Screen:
        id: main_screen
        name: "main_screen_name"
        manager: screen_management
    Input_Screen:
        id: tire_setup_screen_id
        name: "tire_setup_screen_name"
        manager: screen_management
    Input_Number_Inch_Screen:
        name: "inch_screen"
        manager: screen_management

<Main_Screen>:
    canvas:
        Color:
            rgb: [.30, .30, .30]
        Rectangle:
            pos: self.pos
            size: self.size
    Button:
        background_color: .52, .52, .52, 1
        bold: 1
        color: .0078,.67,.69,1
        size_hint: .2, 1
        pos_hint: {"x": 0, "center_y": .5}
        on_release: root.manager.current = "tire_setup_screen_name"
        text: " INPUTS "
        font_size: 30

# Screen 1: Input Screen
<Input_Screen>:
    canvas:
        Color:
            rgb: [.30, .30, .30]
        Rectangle:
            pos: self.pos
            size: self.size

    GridLayout:
        cols: 2
        pos: (160,150)
        size_hint: (.8, .8)

        Button:
            background_color: .52, .52, .52, 1
            bold: 1
            color: .0078,.67,.69,1
            font_size: 30
            text: "INPUT\n(Inch)"
            size_hint_x: None
            width: 150
            on_release: root.manager.current = "inch_screen"
            # This button will go to the screen2

        Button:
            id: inch_input
            background_color: .52, .52, .52, 1
            bold: 1
            color: .0078,.67,.69,1
            font_size: 100
            text: "THIS IS THE TEXT THAT I WANT TO UPDATE"

# Screen 2: Input Inch Screen Data
<Input_Number_Inch_Screen>:
    canvas:
        Color:
            rgb: [.30, .30, .30]
        Rectangle:
            pos: self.pos
            size: self.size

    GridLayout:
        orientation: 'vertical'
        display: entry
        rows: 6
        padding: 10
        spacing: 10

# This is the TextInput
        BoxLayout:
            TextInput:
                id: entry
                font_size: 75
                multiline: False

# This will be the button that would go back to the screen and update
# the button text with the new text entered in the TextInput
        BoxLayout:
            spacing: 10
            Button:
                background_color: .52, .52, .52, 1
                bold: 1
                color: .0078,.67,.69,1
                font_size: 40
                text:"ENTER"
                on_release: root.manager.current = "tire_setup_screen_name"
                on_press: root.manager.ids.tire_setup_screen_id.ids.inch_input.text = entry.text
Related Posts Related Posts :
  • How to use discord bot commands and event both?
  • Python3 - print string and list
  • Running sums from one column conditional on values in another column
  • How to create dictionary combinations? Costliest car problem
  • Select each letter in a file, then find its ASCII value (Python)
  • Python: logarithm to base 2 in nested lists
  • Knapsack algorithm, weird behavior (python3)
  • How to use the break between lines in a txt file to start a new list in Python 3
  • Default *key* when accessing dictionary?
  • "TypeError: a bytes-like object is required, not 'str'" during OAuth 2.0 callback request
  • Lat Long won't show on Heatmap with ipyleaflet
  • Python Flask paginate error:paginated page returned 404
  • can't pickle _thread.RLock objects when running tune of ray packge for python (hyper parameter tuning)
  • Bijective function between two nested lists (Python)
  • How to get python console logs on my tkinter window instead of a CMD window while executing an exe file created using py
  • how combine '"+variable+"' in python 3
  • Year wise cumsum based on condition on other column Python 3+ Pandas data frame
  • How to send a message with discord.py from outside the event loop (i.e. from python-telegram-bot thread)?
  • BytesIO replaces transparency in PNG files with black background
  • Cannot resize and save image of type .tif after patch extraction with tf
  • Pandas Column Names Not Lining Up When .dat File Read
  • Adding an Image to the python GUI from within the script
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org