'Unable to place my button to the specified side in tkinter

I was using tkinter in python 3.6 so that i could learn GUI programming. I tried to create a button. When I try to pack my button to left, right, top or bottom I am not getting the output whereas the side=top works for the frame command.please help me. Thanks in advance.

         from tkinter import *
         import tkinter as tk
         root = tk.Tk()
         topframe = Frame(root)
         topframe.pack()
         bottomframe = Frame(root)
         bottomframe.pack(side=BOTTOM)
         button1 = Button(topframe, text="helo boys", fg="green")
         button1.pack()
         button2 = Button(topframe, text="how are you", fg="red")
         button2.pack(side=LEFT)
         button3 = Button(bottomframe, text="we are fine", fg="blue")
         button3.pack(side=RIGHT)
         root.mainloop()          


Solution 1:[1]

You need to pack both buttons to the tk.LEFT of the topframe:

import tkinter as tk


if __name__ == '__main__':

    root = tk.Tk()

    topframe = tk.Frame(root)
    topframe.pack()

    bottomframe = tk.Frame(root)
    bottomframe.pack(side=tk.BOTTOM)

    button1 = tk.Button(topframe, text="hello boys", fg="green")
    button1.pack(side=tk.LEFT)
    button2 = tk.Button(topframe, text="how are you", fg="red")
    button2.pack(side=tk.LEFT)

    button3 = tk.Button(bottomframe, text="we are fine", fg="blue")
    button3.pack(side=tk.RIGHT)

    root.mainloop()

button3.pack(side=tk.RIGHT) has the same effect as button3.pack() because this element is the only widget in bottomframe

Solution 2:[2]

import tkinter as tk


if __name__ == '__main__':

    root = tk.Tk()

    topframe = tk.Frame(root)
    topframe.pack()

    bottomframe = tk.Frame(root)
    bottomframe.pack(side=tk.BOTTOM)

    button1 = tk.Button(topframe, text="Hello boys", fg="green").place(x=140, y=380)
    button2 = tk.Button(topframe, text="How are you", fg="red").place(x=140, y=380)
  

    button3 = tk.Button(bottomframe, text="We are fine", fg="blue").place(x=140, y=380)

    root.mainloop()

Solution 3:[3]

First, here you are missing the concept of Redis clustering and networking.

Just starting the 3 replicas won't resolve your issue, and they won't interact with each other.

What you are trying to do is replication or clustering across the PODs.

Second issue :

You have mentioned

accessModes:
    - ReadWriteOnce

in PVC and PV due to this your all PODs cannot be attached to single PV or PVC.

You have to use the ReadWriteMany or services like NFS or EFS to create PV, PVC and attach single PV, PVC behind all PODs.

Third issue :

Redis Pod with 3 replicas and Persistence Storage not providing data all the time

You are just running the image without any type of backup or snapshot configuration

- name: redis
  image: redis

Start AOF & RDB

image: redislabs/redis
args: ["--requirepass", "admin", "--appendonly", "yes", "--save", "900", "1", "--save", "30", "2"]

Redis support 2 types of backup support to persiste the data.

AOF & RDB you can read more at : https://redis.io/topics/persistence

Final answer :

Instead of trying to configure the Redis and Replication, i would suggest using the Helm chart which will create the Statefulsets and PVC by own without doing many configurations and you can run the HA Redis cluster with persistence data.

Helm chart link : https://docs.bitnami.com/tutorials/deploy-redis-sentinel-production-cluster/

Chart YAML : https://github.com/bitnami/charts/tree/master/bitnami/redis

This is the Redis HA cluster with sentinel configuration.

Read more about the sentinel at :

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Reblochon Masque
Solution 2 CodeWizard777
Solution 3 mdobrucki