#user-interfaces

1 messages ยท Page 65 of 1

dusk oriole
#

when i click play i want it to open this

#

how can i do it

dusk oriole
#

HELLO?

#

IS ANYWON HERE

wary fable
#

@digital rose can you send me an invite to your tkinter server?

modern marsh
#

Yes

hazy cosmos
#

(If i understood you)
create another function with all the game content and then add py myButton = Button(root, text="Play!", pady=50, command = **yourfuncname**)
then it will link the button to the function and move to the function

ofcourse u will need to create screen2 in the new function

hazy cosmos
shadow quest
#

How can i run my app without pycharm?

north ore
copper tangle
#

go to command prompt and copy your project path then, write (if u use windows) cd 'path' in your command prompt

north ore
copper tangle
north ore
#

but u gotta cd into it though

copper tangle
#

I explained above

dusty scarab
#

What's the best UI framework to handle a Text widget like buffer?

hazy cosmos
#

working on new project

opal reef
#

Hii! This is new to the server a CS student ... just learning ....would you guys please help me regarding new concepts...

hazy cosmos
#

help with what

opal reef
#

Its tell me about new programs how to operate them like thiss...

hazy cosmos
#

learn python basic then tkinter as example

opal reef
#

I am familiar with some of the basics of python

#

Just started learning this year

hazy cosmos
#

i would say learn the basic even more good
then learn how to use tkinter

opal reef
#

okay!

#

would you please tell me something about tkinter

#

@hazy cosmos

hazy cosmos
#

sure y not

#

mmm its some kind of libary or something that allowd you to make windows using python

#

buttons, inputs,labels and stuff

#

as example this

opal reef
#

Okay

#

Anything else for me?

modern marsh
#

its a GUI library

#

see yt videos or the documentation to learn it

dusk oriole
north ore
#

cool

#

you coded it yourself?

hazy cosmos
#

Feel free to help me there tkinter guys

olive quartz
#
from tkinter import *

def login_button_clicked():
    login_window = Tk()
    login_window.geometry("400x400")
    login_window.title("Login Page")


welcome_window = Tk()
welcome_window.geometry("400x400")
welcome_window.title("Password Hasher Tester")
welcome_window_header = Label(welcome_window, text="Welcome! You can either login or register here.", font='Helvetica')
welcome_window_header.place(x=45, y=80)

login_button = Button(welcome_window, text="Login", fg='white', bg='gray', command=login_button_clicked())
login_button.place(x=180, y=180)

register_button = Button(welcome_window, text="Register", fg='white', bg='gray')
register_button.place(x=175, y=230)

welcome_window.mainloop()
#

i want to make it so that when i click the login_button

#

the login_window opens

#

but right now that window opens as soon as i run the program

#

can anyone help?

lofty pond
#
command=login_button_clicked()

Make sure to not call the function

olive quartz
#

wait what

#

@lofty pond what do i do then

#

if i dont call the funciton

#

?

lofty pond
#

When you want a button to run a function, you do not put the parentheses

olive quartz
#

ok i see what u mean i removed the parentheses

#

also another question

#

now everytime i click login it opens a new login window

#

do u know how i can prevent this? @lofty pond

#

like if the login window is already oepned i dont want to allow another one to open

lofty pond
#

Probably assign the window to a variable and when you press the button, check the variable.

olive quartz
#

ok thanks

olive quartz
#

im trying to make my gui class structured

#

does anyone know how i can make a function that opens a new window when i use it as a command for a button

mint cloak
#
#

Im just very confused~

austere dove
#

I'm using tkinter to make an application, and for the application I am making a custom title bar. I used overrideredirect(1) to get rid of the native OS title bar, but how would I go about adding the program back into the native Window Manager so that it shows up in Task Manager and on my Taskbar. I don't want the native title bar to reappear though, and that's where I am stuck.

dusty scarab
#

Either that, or use a Label() as an alternate titlebar. Then you have to bind() several events to achieve the same result.

austere dove
dusty scarab
#

You can change the color of the label if you go that route.

austere dove
#

It seems to better handle what Iโ€™m trying to do

dusty scarab
#

It's a text editor I'm working on. Still have a ways to go. I think I'm 60% of the way done.

#

I don't know PyQT

austere dove
#

Looking good so far. Qt seems to better suite me I feel now that im really thinking about it. I want a nice looking UI and tkinter makes that hard to do.

modern marsh
#

its easier to make better looking GUI's

dusty scarab
#

Just adding keyboard ESC/Enter to the dialogs now.

hazy cosmos
#

can someone help me with grid on tkinter

hazy cosmos
#

i need your help tkinter guys

boreal shard
#

hello, tkinter starter here. I coded a button but the button isnt showing as you see in this screenshot

#

will send the code in a minute

#
import tkinter as tk
#from tkinter import *
import os
# designing the gui
root = tk.Tk()
canvas = tk.Canvas(root, height=700, width=700, bg = "#302f2f")
canvas.pack()
frame = tk.Frame(root, bg="#7d7c7c")
frame.place(relwidth=0.8, relheight=0.8, relx=0.1, rely=0.1)
register = tk.Button(root, text="Register License", padx=10, pady=5, fg="white", bg="#302f2f")
register.pack()
root.mainloop()```
modern marsh
meager spoke
#

Is it OK to use the MIT license for a project that uses Pyside/Qt for Python?

wet plank
amber roost
# wet plank With tkinter is it possible to add comma seperator for 1000s in the entry module...

That sort of stuff is a real pain to do with tkinter.
You would basically need this entry to work three ways; being able to change itself if it's modified, properly formatting itself when changed from the slider and probably also be able to convert a formatted input back into a number. You could use an amalgamation of a focusout validation command and a textvariable that listens to changes, and constantly calculate forth and back between string and int; but those are dangerous to mix: https://www.tcl.tk/man/tcl8.6/TkCmd/entry.htm#M12.
I would almost recommend subclassing tkinter.Entry into something like FormattedEntry which keeps track of the true value internally and only uses the entry as a front to display this value in a formatted fashion

prisma citrus
#

Which is the easiest module to use to make a basic User Interface?

#

Ping me of u know!

#

If*

hazy cosmos
#

just learn one

#

i like tkinter

prisma citrus
#

Oh well

#

Is it easy to use?

digital rose
#

Yeah

prisma citrus
#

Anything better and easier than tkinter?

digital rose
#

I think its a good place to start

prisma citrus
#

Well I just wanna make a prototype of an app for now, I just wanna make a basic example of how it will work and stuff

digital rose
#

I'm not to advanced in Tkinter, I'm still learning it.

#

But its good so far

prisma citrus
#

Oh well

#

From where to learn?

digital rose
#

What exactly would you be trying to make?

amber roost
#

You asked for easy and basic; tkinter checks both of these (also in its general look, unfortunately)
There is PySimpleGUI, which is able to build a tkinter UI from a really easy to write layout list, but it runs on a special event loop; should be understandable with its docs

digital rose
#

What of GTK? I've heard of it but never knew if it was good.

prisma citrus
digital rose
#

Neat. If you ever finish it let me know ๐Ÿ˜„

prisma citrus
#

Ah, well am finishing it always

#

BTW can we talk in DM'S?

#

About that GUI thing

digital rose
#

Me?

prisma citrus
#

Yes.

#

Lol

digital rose
#

I've actually got some school stuff to do

#

But we can chat later

prisma citrus
#

Oh

#

Sure

#

DM me when u get free?

digital rose
#

Sure

wet plank
#

@amber roost , think I'll drop doing it for now as its a class assignment and I think its best not to overcomplicate things haha

#

but thanks for your reply! ๐Ÿ™‚

ionic moat
#

How do I change the border of a QComboBox when the cursor is hovered over it I tried this: css QComboBox::hover { border: 1px solid rgb(0, 145, 133); } but it didn't work

#

This is for PyQT5 Stylesheet

#

This is QSS, Qt's version of CSS

weary wolf
#

I don't know much about licensing. Does "PyQt5 is released under the GPL v3 license and under a commercial license that allows for the development of proprietary applications" mean I can create an application with PyQt5 for commercial use for free?

digital rose
#

Using Tkinter, I'm following along in this tutorial from youtube, and at one point when I ran this code -

import tkinter as tk

HEIGHT = 700
WIDTH = 800

root = tk.Tk()

canvas = tk.Canvas(root, height = HEIGHT, width = WIDTH)
canvas.pack()

frame = tk.Frame(root, bg = '#80c1ff', bd=5)
frame.place(relx = 0.5, rely = 0.1, relwidth=0.75, relheight=0.1, anchor='n')

entry = tk.Entry(frame, font=40)
entry.place(relwidth=0.65, relheight=1)

button = tk.Button(frame, text="Test button", font=40)
button.place(relx=0.7, rely=1, relwidth=0.3)

# label = tk.Label(frame, text = "This is a label", bg = "yellow")
# label.place(relx=0.3, rely=0, relwidth=0.45, relheight=0.25)

root.mainloop()

There was a button behind the light blue frame. For him, the button was infront like it should have been. Mine was hidden behind the frame. Does anyone know why?

amber roost
#

Are you sure the the code is the same as in the video?
I'm not really seeing anything wrong with this since widgets placed/packed/gridded later should appear in front of others unless you mess around with tkraise and lower

digital rose
#

Yeah I checked line for line, I didn't see anything wrong.

#

I'll keep looking though

amber roost
#

Although, shouldn't the canvas appear in front of everything?

#

I never used the place manager, no idea how these widgets are laid out; I'll run this myself real quick

#

skimming over it, shouldn't it be rely=.1 or something to line up with the entry?

#

no what am i saying

#

The entry doesn't have any rely so it should just be possible to omit it entirely

#

Changed the button's place command to button.place(relx=0.7, relwidth=0.3, relheight=1), that makes it visible at least; could you send the youtube link though? I want to find that error

ionic moat
digital rose
#

Oh sorry @amber roost Just saw your response - here is the link: https://www.youtube.com/watch?v=D8-snVfekto&t=1845s

Code faster & smarter with Kite's free AI-powered coding assistant!
https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=keithgalli&utm_content=description-only

In this video, we learn how to build an application with a graphical user interface (GUI). This is a great video to learn how to use the Tkinter library as...

โ–ถ Play video
#

Omg

#

I just found the problem

#

I feel like an idiot

#

When you place the button, I put rely = 1, but it should be relheight = 1

#

Sorry about that

amber roost
#

this sort of stuff happens all the time, nice you got it figured out ๐Ÿ‘

olive quartz
#
from tkinter import *

# Sets the welcome window
welcome_window = Tk()
welcome_window.geometry("400x400")
welcome_window.title("Password Hasher Tester")
Label(welcome_window, text="Welcome! You can either login or register here.", font='Helvetica').place(x=45, y=80)

# Sets the username and password variables for login page
login_username = StringVar()
login_password = StringVar()

# Sets the username and password variable for register page
register_username = StringVar()
register_password = StringVar()


def login_submit_button_clicked():
    print(login_username)
    print(login_password)


# Sets the login page when the login button is clicked
def login_button_clicked():
    login_window = Tk()
    login_window.geometry("400x300")
    login_window.title("Login Page")
    Label(login_window, text="Login Here", font='Helvetica').place(x=160, y=40)
    Label(login_window, text="Username", font='Helvetica').place(x=60, y=100)
    Label(login_window, text="Password", font='Helvetica').place(x=60, y=140)
    Entry(login_window, textvariable=login_username, font='Helvetica').place(x=160, y=100)
    Entry(login_window, textvariable=login_password, font='Helvetica').place(x=160, y=140)
    Button(login_window, text="Submit", fg='white', bg='gray', command=login_submit_button_clicked).place(x=180, y=210)
#
# Sets the register page when the register button is clicked
def register_button_clicked():
    register_window = Tk()
    register_window.geometry("400x300")
    register_window.title("Register Page")
    Label(register_window, text="Register Here", font='Helvetica').place(x=160, y=40)
    Label(register_window, text="Username", font='Helvetica').place(x=60, y=100)
    Label(register_window, text="Password", font='Helvetica').place(x=60, y=140)
    Entry(register_window, textvariable=register_username, font='Helvetica').place(x=160, y=100)
    Entry(register_window, textvariable=register_password, font='Helvetica').place(x=160, y=140)
    Button(register_window, text="Submit", fg='white', bg='gray').place(x=180, y=210)


# Sets the login button
Button(welcome_window, text="Login", fg='white', bg='gray', command=login_button_clicked).place(x=180, y=180)

# Sets the register button
Button(welcome_window, text="Register", fg='white', bg='gray', command=register_button_clicked).place(x=175, y=230)

welcome_window.mainloop()
#

so im tryng to retreive the users entry

#

but this is what i get

hazy cosmos
#

its realy complicated for no reason

tribal path
#

.get()

digital rose
#

Also, where is the StringVar() function you set login_username and login_password to?

#

I might just be blind, or not getting something, but I don't see it

#

Yeah, I messed around with your code, @olive quartz, and I get messages saying StringVar() is undefined, so write the function for that, or, just change it to something else : D

olive quartz
#

login_username = StringVar()
login_password = StringVar()

#

i did this at the top

#

@digital rose

#

is that not enough?

digital rose
#

So the thing is, StringVar() is undefined

#

The code doesn't know what that means

olive quartz
#

oh

tribal path
#

Those should come from the star import.

olive quartz
#

yeah i thought it did

digital rose
#

You'd think.

#

I've been having trouble with the star import too

#

I would get errors for Labels not being a thing, when I imported with the star

olive quartz
#

so how can i import it then

digital rose
#

Try writing - from tkinter import StringVar() or something

olive quartz
#

just tried that

#

it doesnt work

tribal path
#

In your case it looks fine, just missing the get()'s when you try and print

olive quartz
#

when i did .get

#

it just prints blanks

#

@tribal path

digital rose
#

make sure you put parenthesis

#

Its a function

hazy cosmos
#

@olive quartz

#

i have a good video about this if u want

#

i learned it a day ago

olive quartz
#

ok thanks

#

yeah i put a parentheses

tribal path
#

Did you type in the entries?

olive quartz
#

@digital rose

#

yeah

digital rose
#

Yeah?

hazy cosmos
# olive quartz ok thanks

(How to create a graphical register and login system in python using Tkinter) - This video is a basic tutorial which uses tkinter to build a program which will allow users to register an account on the software which they can later log in to. The second part of this tutorial will be uploaded very shortly.

Link to code: http://zipansion.com/41uo...

โ–ถ Play video
#

watch this vid

olive quartz
#

oh ok

#

thanks

hazy cosmos
#

make sure u understand what each part means dont just copy what he says

ionic moat
#

how do I make my window frame look like this

digital rose
#

@ionic moat what are you using?

ionic moat
#

PyQT5

digital rose
#

Why you using PYQT5 when we got pysimplegui

ionic moat
#

Because PyQT5 is better

digital rose
#

Nope

ionic moat
#

but I'm almost done my UI in PyQT5

#

I just need that part

digital rose
#

Oh ok

dusty scarab
#

Each UI has its strengths and faults.

ionic moat
#

?

dusty scarab
#

On tkinter Text() widgets, you can do .search() and search for a regex. How do you know when you've reached the end of the regex?

ionic moat
#

idk dollar sign

dusty scarab
#

From what I'm reading in the docs, it only returns the starting pos of the search, not the ending pos.

ionic moat
#

okay well I still need to change the frame

unique forge
#

@digital rose PyQt5 is better

#

@ionic moat you have to make it yourself, and remove the default onr afterwards

ionic moat
#

Oh

#

so how to remove the default one

unique forge
#

ill give you later

#

I dont have it right now

ionic moat
mint cloak
#

Can i resize the terminal with npyscreen to a specific dimension?

#

like 300x50?

mint cloak
#

Anybody around?

#

Id just like to bounce some ideas around

#

having some, trouble implementing npyscreen

#

im a bit worried but, i think im getting there..

#

Hey uhm, is this the right place?

#

im really, not like, super stressed but.. i dont ususally get no response on irc, discord, i feel like.. maybe my choice of library was wrong and

#

thats stressful since, i only have so much time to get all of this done, i dont want to be changing libraries and ive already gotten pretty far with npyscreen

#

im sure i can make this work, i just dont know how yet

#

thats important, haha

meager spoke
#

How to implement navigation in PySide?

digital rose
#

๐Ÿ‘

digital rose
#
root.geometry("300x50")
#

if you want min size for the window:

root.minsize(width=900, height=720)

the same as max size:

root.maxsize(width=900, height=720)
mighty rock
#

if you want to make a window not resizable you should use root.resizable(False, False)

digital rose
#

if you want to make it maximize do this:

#
root.state('zoomed')
sudden falcon
#

This will remove title bar

#

Now you need to create whole title bar which contain close , minimize button , etc as per you requirements

prisma citrus
#

anyone here used PySimpleGui?

#

I needed some help

#

please ping/DM me if you have

modern marsh
sudden falcon
#

Yeahplus1

fallow nimbus
#

does someone have a good source to read about all this pyside{1,2,6} vs. pyQT stuff, I feel kind of lost of what is going to be used in the future or what should be used...

digital rose
#

I think PyQt is better than any GUI module in python

#

as me Tkinter programmer

fallow nimbus
#

But what about all this pyside vs. pyqt stuff beside of ideologies I would love to read about the differences and potentially which one is going to stay

digital rose
#

is there any good library for creating "click-through" overlay stacked on a full-screen application which is only visible and all events are going into the application instead of overlay? i know in c++ i can achieve that by using directx but in python? dunno if its a good channel for that. I tried tkinter, but moving sprites in that isn't what satisfies me

meager spoke
#

How to implement navigation in PySide?

clever grove
#

Hey guys , what about kivy/kivymd? Building apps with python?

hazy cosmos
#

as this channel is for pyqt, tkinter and so

clever grove
#

i saw userinterface my bad

hazy cosmos
#

no problem ๐Ÿ™‚

#

send a msg there

clever grove
#

Shityy deals this seems like the spot to discuess g.u.i's and modules used to create them, curious on a python script in pyqt or tkinter with just a textfield and button?

#

How many lines of code can do this on a curiosity point of view and how readable can it be to say a non programmer?

#

sorry to bother you, as im not really looking for a tutorial , just curious

#

from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager

KV="""
MDScreen:
md_bg_color:0,0,.4,.3
MDBoxLayout:
orientation:'vertical'
MDToolbar:
title:"Practice App"
anchor_title:"center"
MDFloatLayout:
MDLabel:
text:"Hello World"
pos_hint:{"center_x":.5, "center_y":.9}
halign:"center"
bold:True
font_style:"H4"
outline_color:1,0,0,.4
outline_width:3
MDTextField:
id:username
size_hint:.7,None
pos_hint:{"center_x":.5, "center_y":.6}
hint_text:"Username:"
MDTextField:
id:password
size_hint:.7,None
pos_hint:{"center_x":.5, "center_y":.5}
hint_text:"Password:"
password:True
MDTextButton:

			pos_hint:{"center_x":.5, "center_y":.4}
			text:"Login"
			outline_color:0,1,1,.4
			outline_width:3
			font_size:"32dp"
			on_release: username.text =""; password.text =""

"""

class My(MDApp):
def build(self):
self.manager =ScreenManager()
self.manager.add_widget(Builder.load_string(KV))
return self.manager

My().run()

#

Hey guys sorry to intrude anyways your all doing good!! :) byee

modern marsh
#

kivy is a GUI module

silent cape
#

What is the best cli framework

proven basinBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

unique forge
#

@hazy cosmos Kivy is a GUI module also

digital rose
#

i wish it could be possible to do GUIs like in visual studio c#

#

winforms

#

but python

modern marsh
#

use PySide2 etc

#

amazing GUI's

digital rose
#

with c# there's no GUI code

ionic moat
#

Can anyone help me?

silent cape
#

so o ones knows a solid cli

ionic moat
#

When I get the value of QSpinBox, I wanna wait for it change to something else, anything that's not the initial value, in this case, wait for the value of it to change to something that is not 0

sudden falcon
sudden falcon
ionic moat
#

wdym?

#

like py while True: if QSpinBox.value() != 0: break like this?

#

this is resource intensive

#

there shouldn't be a delay either

meager niche
#

how do u put code in here? just copy and paste ?

modern marsh
#

!paste

proven basinBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

modern marsh
#

@meager niche

ionic moat
#

does anyone know?

meager niche
#
class MyMainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MyMainWindow, self).__init__(parent)
 
class FormWidget(QWidget): 
    def on_combobox_changed(self):
            output = self.combo.currentIndex()
            print(output) 
    def __init__(self, parent):        
        super(FormWidget, self).__init__(parent)
        self.combo = QComboBox()
class Delegate(QtWidgets.QStyledItemDelegate):
    def createEditor(self, parent, option, index):
        if index.column() ==  3: 
#

woho

#

perfect

#

i want help reading the value of output from the method on_combobox_changed and insert it in index.column()

ionic moat
#

wait wait I'm confused

#

oh

#

lol

meager niche
#

deleted a lot of irrelevant code to get the issue

#

Welp! Ping me if u think u could help. Cheers

sudden falcon
ionic moat
#

int

#

an integer between 1 and 5

sudden falcon
#

Then set initial value

#

Now if you will fetch the value you will get that initial value

ionic moat
#

yes

#

what?

#

I still don't understad

silver widget
# ionic moat When I get the value of `QSpinBox`, I wanna wait for it change to something else...

The approach I've taken is to connect a slot to the combobox.currentIndexChanged signal

# In the objects's __init__ method, typically.
self.comboBox.currentIndexChanged.connect(self.handler)

# Then you can check if it's non-zero

def handler(self):
  digit = int(self.comboBox.currentText())
  if digit > 0:
    # do the thing

This will avoid any unnecessary loops that check for changes every x milliseconds.
I'm not entirely sure what your on_combobox_changed function does though.

ionic moat
#

ohhhhhhhh

#

that looks like it makes sense

#

lemme try it

#

does this also work for spinBox?

silver widget
#

Ah, I just noticed that I was looking at my combobox, the qspinbox has the signal valueChanged

ionic moat
#

oh okay

silver widget
#

Signals and slots are easy to set up, they are definitely the way to go whenever you need to wait for an interaction, and wish to trigger action in another widget.

silver widget
ionic moat
#

I have another question

#

Is there a way to make it so I can actually see the error raised if something goes wrong

#

it doesn't show any error

#

all it does it crash the GUI and end

#

no error

silver widget
#

Hm, the only cases I can think of is if you are catching the error in a try except block somewhere

#

If you're crashing Qt's GUI, that's an accomplishment. It won't divulge any errors though, since it runs natively in C++

#

You can insert print statements to see at what point the code crashes, to narrow down the search.

ionic moat
#

also another problem

#

Here's how it goes

#

So I have separate classes for separate GUIs

#

now I wanna access the spinbox in GUI2 in GUI1 and connect it to a function in GUI1, but I can't because the instance of GUI2 is not defined at the stage for some reason

#

I want to connect spinBox from GUI2 to function in GUI1

#

because button functions can't return anything for some reason

silver widget
#

I would set up a signal the spinbox emits, then connect the signal to a function in GUI1.

#

You can also send data with a signal.

#

First, you need to declare the signal within GUI1 like this: (as a member variable)
sigSomethingHappened = QtCore.Signal(object, object, ...)
You can optionally add as many data snippets the signal should carry.

#

You can then emit the signal when the time is right, like at the end of your spinbox's handler function
self.sigSomethingHappened.emit(data0, data1, ...)

meager spoke
#

How to implement navigation in PySide?

ionic moat
#

is there a way for me to this in a function py return_value = PyQt5.wait_for(signal) and then somewhere else I can do py signal.emit(value_of_spinbox) where the first line waits for the signal to emitted and the return_value is what it emitted

silver widget
#

You'll also need to connect that signal from GUI1 to a function in GUI2 like with the valueChanged signal.

ionic moat
#

but the return value doesn't have to matter if that's impossible

#

just wait

#

just make it wait

silver widget
#

You'll want to connect the signal to a local function, one with the following decorator:

 @Slot(int)
 def do_what_Ive_been_waiting_for(self, index):

The slot decorator with capture an integer from the signal and pass it on to your function's first argument, index

ionic moat
#

what about waiting

#

I need my program to wait

#

actually I just need to function to wait

#

wait until I recieve this signal

meager spoke
#

@silver widget can you answer my question?

silver widget
#

Could you elaborate, @meager spoke ?

silver widget
ionic moat
#

wdym connecting it to the signal

meager spoke
silver widget
#

You'll need to do the GUI1.sigSomethingHappened.connect(do_what_Ive_been_waiting_for) in GUI2

silver widget
meager spoke
ionic moat
#

ohhhh

#

Wait

#

I want do_whatIve been watiing for in gui1

#

becaue I need index in that class

#

is that okay?

#

because the spinbox comes from GUI2

#

GUI2 is useless except for the spinbox

meager spoke
silver widget
silver widget
ionic moat
#

There's a button in GUI2 that should be pressed

#

so by doing this, it'll wait for that button to be pressed (it's going to wait for that button to be pressed in a function in GUI1) and when it is pressed, it'll resume that function in GUI1 by emitting a signal

#

correct?

#

Okay I think it'll be easier if I give a code example

#

I'm sorry if I'm being a bit hard right now

meager spoke
silver widget
#

Yes, if you link the function that will carry on with your work to the other GUI's signal, it will have to wait for it to be emitted.

silver widget
# meager spoke i am using grid layout

So both widgets are visible at the same time? Then you should have access to both in the same class, right? Some sample code could help me understand.

meager spoke
ionic moat
#
class GUI1(MainwWindow):
  def __init__(self):
    self.button = pyqt5.button()
    self.button.clicked.connect(self.function)
  
  def clicked_button(self):
    # do things
    
    if variable == "this":
      return_value = pyqt5.wait_for_signal(gui2.signal) # nothing below this runs until the signal is emitted
      # after the signal gets emitted, do the rest of the code
    ...

class GUI2(OtherWindow):
  def __init__(self):
    self.spinBox = pyqt5.spinBox()
    self.signal = QtCore.Signal(int)
    self.spinBox.valueChanged.connect(self.emit_signal)
  
  def emit_signal():
    value = self.spinBox.value()

    if value > 0:
      self.signal.emit(value) # this activates the wait function above in GUI1 and emits the value
silver widget
ionic moat
#

something like this

meager spoke
silver widget
#

Ah, the thing with clicked_button, you'd put that in place of the self.function, so self.clicked_button. That will call the clicked_button function every time the button is pressed.
You cannot halt execution to wait for a signal, you will need a second function to handle the return value.
The GUI2 code looks good to me

silver widget
meager spoke
silver widget
silver widget
ionic moat
#

this is getting real complicated rn

#

all these signals are making me confused

ionic moat
#

But I still have a question, sorry if I'm being repetitive or annoying but what about waiting?

#

Like a wait thing for signal?

#

I'm still confused about that

silver widget
#

If you only need to know the value of the spinbox, simply do a self.otherGui2.spinbox.value()

#

And keep a reference to the other GUI in GUI1

meager spoke
#

@silver widget can you tell some nice resources to learn PySide?

ionic moat
#

this is how it goes

#

they choose image polishing and press the button edit image

#

edit image opens that GUI and asks for a number

#

the other GUI is GUI2 here

silver widget
# meager spoke Ok.I will try it.Thanks

If you wish to open the login page later, you can also use the stackedwidget, then simply change the stackedwidget.setCurrentIndex() to the dashboard's index without deleting anything.

ionic moat
#

when they choose their number in GUI2, they press OK and that sends the in to GUI1 button "Edit Image"

silver widget
#

Good luck!

silver widget
ionic moat
#

I did

ionic moat
#

GUI2 is a Dialog

#

It inhertis from QDialog or something like that

silver widget
#

With dialogs I've done this in the past:

reply = QMessageBox.question(self, "window title", "Are you sure", QMessageBox.Yes, QMessageBox.Cancel)
if reply == QMessageBox.Yes:

Something like that will be possible, lemme see how that would be done with a custom widget.

ionic moat
#

Alright

#

Here is a nice image to explain

silver widget
#

Alright, so it's pretty easy:
You'll need to open your dialog like this:

class GUI1(MainwWindow):
  def __init__(self):
    self.button = pyqt5.button()
    self.button.clicked.connect(self.clicked_button)
  
  def clicked_button(self):
    # do things
    
    if variable == "this":
      dialog = GUI2()
      if dialog.exec_() ==   #This will halt execution until GUI2 is closed, and be true if GUI2 was closed with self.accept() or similar
        # do the thing
        if dialog.value is None: #Welp, something went wrong here
    ...

class GUI2(OtherWindow):
  def __init__(self):
    self.spinBox = pyqt5.spinBox()
    self.signal = QtCore.Signal(int)
    self.spinBox.valueChanged.connect(self.emit_signal)
    self.value = None
  
  def emit_signal():
    self.value = self.spinBox.value()

    if value > 0:
      self.accept()      
silver widget
ionic moat
#

Wow

#

Lemme try this

silver widget
#

You can also cancel your dialog by calling self.close() or self.reject() I think

ionic moat
#

yeah I did self.close_button.clicked.connect(self.close)

#

pretty cool

#

lemme try this

silver widget
#

Calling exec_() generally isn't all that recommended, since it halts all other windows, but it's what you want in this case. Otherwise just call open()

ionic moat
#

so what do I do for that though

#

Like I'm comparing it

#

if dialog.exec_() ==

#

there has to be a value on the right side right?

silver widget
#

It'll return some boolean, true for accept(), I think

ionic moat
#

so if the value of dialog is not None, it means the signal was accepted right?

silver widget
#

If it's none, that means the spinner wasn't updated and the window was closed forcefully.

#

yeah

ionic moat
#

what about QtCore.Signal? It says that doesn't exist

#

do I have to use pyqtSignal?

silver widget
#

Have you imported signal?

ionic moat
#

import signal?

silver widget
#

it's in QtCore, iirc

ionic moat
#

it's pyqtSignal though right?

#

QtCore.pyqtSignal

silver widget
#

it's just Signal

#

Though, I'm using Pyside6, the latest version.

ionic moat
#

but it says QtCore has no attribute 'Signal'

silver widget
#

It seems you're still on the old Qt5, with pyqt5.

ionic moat
#

oh

#

well I haven't updated it since I got it

#

maybe

silver widget
#

The transition seems to be pretty easy, just a couple differences in the import statements.

#

So that's probably one of the things changed since PyQt5

#

I haven't heard of pyqtsignal, but maybe that's the old name for it, you'll have to find out.

ionic moat
#

oh

#

So I have to update PyQt5

#

what about 'CustomResizeGui' object has no attribute 'exec_'

#

I get that

#

I initialized the class

#

idk why I get that

silver widget
#

Is it not inherited from a QDialog?

ionic moat
#

Well I mean

#

it's inherited from a class that inherits that

#

but I can QDialog as a second inherited class

silver widget
#

because exec_ is a QDialog method, so I'm not too sure what's going on

ionic moat
#

okay I added QDialog as a second inhertied class

#

I don't get that error anymore

#

but the GUI just crashes again

silver widget
#

Oh boy

#

All of it?

#

Because a window can also close when its reference goes out of scope.

ionic moat
#

The CustomResizeGui crashes

#

and that causes the Main Window to crash

#

It's not in GUI1 though

#

because I have an exception handler there

silver widget
#

what the heck, I guess GUI2 is not happy about something

ionic moat
#

I should update PyQT5 first

silver widget
#

You can try, not sure it'll fix the problem. There weren't many new features in Qt6, but they did focus on a lot of internal restructuring and bug fixes.

ionic moat
#

wait

#

there's a PyQt6???

#

wow

silver widget
#

Qt6 launched a few months ago, the Python bindings for the C++ libraries are now called PySide6

#

Side is Finnish for connection, so it's the python connector.

#

Their numbering is as messy as Nvidia's.

ionic moat
#

Yeah I don't know what's going on

#

I'll try to catch the exception in GUI2

silver widget
#

Good luck! I'll have to get back to work. Cya!

ionic moat
#

wait if I need your help later may I ping you?

#

you've been the biggest help ever and I really thank you for it

silver widget
ionic moat
#

I found out the problem

#

value wasn't defined

#

but yeah

#

thank you

silver widget
#

Ah, that would do it.

ionic moat
#

yeah but there's another error that I can't find

#

I wish it would tell me

#

but I just have to guess where it is

#

okay it was just an indentation error

#

llol

#

this is really confusing

#

I got the dialog.value is None thing

#

it's None

maiden dragon
#

anyone have experience with WXpython AUI or dockable windows

hazy cosmos
ionic moat
#

@silver widget I have another question about PyQT5

#

it doesn't have anything to do with before

#

so I have this piece of code that runs, but it takes a few to run and it interrupts the main GUI

#

how can I run it and not interrupt it

#

interrupt it as in it makes the main GUI stop responding

#

and then after it's done running, the GUI comes back to life

silver widget
# ionic moat it doesn't have anything to do with before

You will want to spin up a second thread, possibly a daemon.
https://www.geeksforgeeks.org/python-daemon-threads/
I haven't done much threading, but this will probably be what you'll need to get started.

ionic moat
#

okay but I also need to to wait for the code to finish running

#

it can't just spawn the thread and continue

silver widget
#

You'll probably be able to connect a signal from the daemon to your main gui

#

Then simply wait for the signal.

ionic moat
#

How do I wait for the signal in the function GUI 1

#

because the signal should be emitted from another class

#

actually it doesn't matter where the signal is being emitted

#

as long as it doesn't make the main GUI unresponsive

silver widget
#

Yup, all the interconnections are handled by qt, thatโ€™s the nice thing about it.

ionic moat
#

so I make a new class that spawns a thread and then after the code finishes, inside of that thread I emit the signal to continue the code in GUI 1

silver widget
#

You'll just have to have a function that starts the process, and then a function that gets called once the thread is done.

#

Yup

ionic moat
#

what's the code to wait for the signal again?

silver widget
#

You don't want to wait for something, per se, you want to simply react to when it happens.

#

Otherwise waiting might mean leaving the gui unresponsive

ionic moat
#

but if I react when it happens, the code will be finished

silver widget
#

Isn't that what you want?

ionic moat
#

should I write pseudo-code to make it more clearer

#

give me one second

silver widget
#

I suppose that would help

ionic moat
#
class OtherThreadClass:
  def __init__(self, arg1, arg2):
    self.arg1 = arg1
    self.arg2 = arg2

    self.signal = QtCore.Signal(bool) # dunno if it requires an argument so I just put bool

  def start(self):
    code_that_causes_the_gui_to_go_unresponsive() # takes time to run
    self.signal.emit(True) # This stops running things_to_run_while_the_signal_has_not_been_emitted_yet() because the signal has been emitted at the point

class GUI1(MainWindow):
  def __init__(self):
    self.button = pyqt5.button()
    self.button.clicked.connect(self.on_click)

  def on_click(self):
    thread = OtherThreadClass()
    while thread.signal.is_not_emitted: # I wanna do things while code_that_causes_the_gui_to_go_unresponsive() is running:
      things_to_run_while_the_signal_has_not_been_emitted_yet()

    #finish up code
    self.close()```
#

here

silver widget
#

Ah, you don't actually want to lock up the gui, that would make the user think it just froze, especially if the code takes more than a few seconds. What you'll want to do is set the setEnabled(bool) property on the relevant GUI elements, which will disable user input when false, graying everything out, without windows thinking it's unresponsive.

#

If you disable the top level widget, all nested subwidgets will also be disabled.

ionic moat
#

oh

silver widget
#

That's the proper way to do it. If you attempt to freeze the gui by entering an infinite loop, it will seem like the window crashed.

#

This way, you can still leave a progress bar and a cancel button enabled.

#

You'll be able to update the progress bar with signals, I guess

ionic moat
#

Oh yeah I'm trying to run a progress bar while it does the thing that crashes the gui

silver widget
#

And having a cancel button is always good practice.

#

Yup, lemme know how it goes!

ionic moat
#

yeah

#

the window still goes unresponsive

silver widget
#

Hm, sounds like the daemon thread isn't properly separated, or is that working?

ionic moat
#

lemme check

#

okay well

#

nothing errors

#

but I need to implement a loading bar in the main GUI that gets signals from the thread

#

so we're doing so far

#

@silver widget ideas?

silver widget
# ionic moat <@!419589672382103562> ideas?

Hmm, treading new ground here for me, so I'll take my best guess.
You'll want the daemon to emit signals, right? That means we'll need to connect the signal from the daemon to a local function that then updates the bar. Since threads share the same memory, it shouldn't be a problem to access the daemon's object, or? It'll need to inherit a qobject, perhaps, if it doesn't work out of the box.

#

Hmm, this is getting tricky

ionic moat
#

Wait but I thought the signal can be emitted through classes, why local function?

silver widget
#

I mean that you catch the signal in a local slot

#

Of the parent's GUI object, like with the GUI1

#

Hm, I'll try getting it working on my end. Sounds fun.

ionic moat
#

I also need the return value of the threaded target function

silver widget
#

You can return values through slots, that may work. Or the traditional way of passing data back from threads.

ionic moat
#

This is so confusing

#

What about Qt's built in thread system

#

QtCore.QThread

tidal kayak
#

Can I ask some -really- stupid question about PyQt5 here? :/ I haven't properly start it.

silver widget
#

Ooh, I've never tried that, though I'm pretty sure it's a vestige to support the C++ variant

silver widget
ionic moat
#

agh PyQt5 is confusing

silver widget
#

Good luck!

#

Also, know that pyqt has been updated to PySide6, that's the newest version for Qt6

tidal kayak
#

ow! I see that PyQt is different from PySide ๐Ÿ˜ฎ I wasn't heard about PySide.

tidal kayak
silver widget
#

It's basically the same, their naming is just screwed up lol

tidal kayak
#

ahah okey, thank you again. I'll try this documentation, my old one is out-dated then.

silver widget
#

Yup, have fun!

ionic moat
#

maybe we can use this to work this out

#

So I got the signal progress bar working from this

#

but now I need to 1. run the long function in the thread, and 2. get that return value, and 3. send it to GUI1's function

silver widget
#

Oh that's neat, I'll have to read up on this

#

The pyqt docs are kinda saturated with c++ at times, so it's nice to have this proper article.

#

Yeah, using a QThread sounds like the way to go here, as it's got the signal and slot support that you need here.

ionic moat
#

Yeah I got it working

#

๐ŸŽ‰

#

thank you for your help

silver widget
#

Fantastic!

silver widget
ionic moat
#

I need a bit more help

#

this one should be less confusing

#

fname = QFileDialog.getOpenFileName(self, "Select Download Directory", "", "*.png, *.bmp") why does this one show .bmp files in the file explorer but not .png

#

the only way to get .png files is by typing them

ivory ember
#
filename, _ = qtw.QFileDialog.getOpenFileName(
  self,
  "Select Download Directory...",
  qtc.QDir.homePath(),
  'Text Files (*.txt) ;;Python Files (*.py) ;;All Files (*)',
  'Python Files (*.py)',
  qtw.QFileDialog.DontUseNativeDialog |
  qtw.QFileDialog.DontResolveSymlinks
)
#

where as

1.) the parent widget
2.) the caption, used in the window title
3.) the starting dir
4.) the available filters
5.) the default selected filter
6.) option flags

#

lmk if that solved your problem

ionic moat
#

nope

#

didn't solve

#

still doesn't show *.png files

#

only *.bmp

ivory ember
#
filename, _ = qtw.QFileDialog.getOpenFileName(
  self,
  "Select Download Directory...",
  qtc.QDir.homePath(),
  'PNG Files (*.png) ;;BMP Files (*.bmp) ;;All Files (*)',
  'PNG Files (*.png)',
  qtw.QFileDialog.DontUseNativeDialog |
  qtw.QFileDialog.DontResolveSymlinks
)
#

did u try like that

ivory ember
#

cause otherwise i dunno

mint cloak
chrome saddle
#

hi everyone, how would i start creating the rest of my gui under each tab? ```python
#tab section
tab_control = ttk.Notebook(window)
ip_scanner_tab = ttk.Frame(tab_control)
ticket_create_tab = ttk.Frame(tab_control)

tab_control.add(ip_scanner_tab,text='IP scanner')
tab_control.add(ticket_create_tab,text='Ticket Creator - Spiceworks')

tab_label_ip_scanner = tk.Label(ip_scanner_tab,text = 'Welcome to my IP scanner')
tab_label_ticket_creator = tk.Label(ticket_create_tab,text = 'Welcome to my Ticket Creator for Spiceworks')

#packs
tab_control.pack(expand =1,fill='both')

#

FYI i'm using tkinter

old badger
#

@chrome saddle ttk.Label instead of tk.Label and you need to tell the labels their positioning, either with pack, or with grid.

#

tab_label_ip_scanner = ttk.Label(ip_scanner_tab,text = 'Welcome to my IP scanner').grid(row=1,column=1)

#

or

#

tab_label_ip_scanner = ttk.Label(ip_scanner_tab,text = 'Welcome to my IP scanner').pack()

#

(Side note: I highly recommend using Qt or wxwidgets instead of tkinter, tkinter is pretty strange at times)

mint cloak
#

@digital rose Sorry to @ you directly, id really love some clarification though..

modern marsh
mint cloak
#

A what object?

modern marsh
#

tkinter

#

the main window

mint cloak
#

I dont know what that is

#

sorry

modern marsh
#

oh ok, shihab was talking about tkinter as far as i know

mint cloak
#

:c

modern marsh
#

best to ask him

mint cloak
#

shoot

modern marsh
#

im not sure

#

let him reply

mint cloak
#

Yeah, sorry

#

its really uncool to @ like that but

#

its been hours

#

ive also been lurking in #python on irc

#

feel kinda lonely

chrome saddle
#

Lol sorry guys.

#

Yes I wanted to use tkinter. I imported to from tkinter

#

@ me is cool. It helps distinguish between whoโ€™s actually talking to me

obsidian pollen
#

When downloading opening the discord app it opened a pop up to link to my browser and check for my previously signed in user name, does anyone know what kind of process this is? Selenium based? Puppeteer?

prisma citrus
prisma citrus
#

Ping me if u know!

tender rivet
#

Hello, I am fairly new to PyQt5 and have been working on my first project with the library for the past few days. I've been struggling with some strange behaviour from my QtWidgets.QSplashScreen SplashScreen. It succesfully displays itself and shortly closes after 3 seconds as specified here QtCore.QTimer.singleShot(3000, self.closeSplash). But as soon as the main app opens, If I try to display anything else, the SplashScreen reapears. And for some reason it only occurs on macOS. It got me wondering, "I'm I properly closing the SplashScreen?". I would highly appreciate any hints on what could possibly be wrong with my code, here's the SplashScreen class for reference, and please do let me know if you need anything else.

#
###--------------------------- SplashScreen ------------------------------###

class splash(QtWidgets.QSplashScreen):
    
    def __init__(self, parent=None):
        super(QtWidgets.QSplashScreen, self).__init__(parent)
        self.splash = QtWidgets.QSplashScreen(QtGui.QPixmap(SplashScreenIMG))
        self.splash.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
        self.splash.show()
        QtCore.QTimer.singleShot(3000, self.closeSplash)

    def closeSplash(self):
        self.close()
        self.main = MainWin()
        self.main.show()

# SplashScreen
if __name__ == '__main__':    
    app = QtWidgets.QApplication(sys.argv)
    main = splash()
    main.show()
    sys.exit(app.exec_())
#

MainWin() is my main app

wind basin
#

Hi, i wanted to learn mobile development and was wondering if react was a good choice. I would only use this framework to create UIs and animations, while the sauce of the app would be written in C. Any of you know if this is possible, if it is, which frameworks do you advise?

warm spire
digital rose
#

hey guys how would i take a pyqt python code and edit it in qt designer knowing i dont already have the main .ui file

unique forge
digital rose
#

alright thanks

winter umbra
#

I'm with tkinter, i have a main window with 3 row and 0 column, and i want to put 8 variables of a list in 8 LabelFarme in the 2nd row of the window, how can i do ?

#
def create_frame_cntr(principal):
    global nmbr_boules

    frame = ttk.Frame(principal)
    frame.rowconfigure(0, weight=3)

    nmbr1 = ttk.LabelFrame(frame, text=str(nmbr_boules[0]))
    nmbr2 = ttk.LabelFrame(frame, text=str(nmbr_boules[1]))
    nmbr3 = ttk.LabelFrame(frame, text=str(nmbr_boules[2]))
    nmbr4 = ttk.LabelFrame(frame, text=str(nmbr_boules[3]))
    nmbr5 = ttk.LabelFrame(frame, text=str(nmbr_boules[4]))
    nmbr6 = ttk.LabelFrame(frame, text=str(nmbr_boules[5]))
    nmbr7 = ttk.LabelFrame(frame, text=str(nmbr_boules[6]))
    nmbr8 = ttk.LabelFrame(frame, text=str(nmbr_boules[7]))

    nmbr1.grid(column=0)
    nmbr2.grid(column=1)
    nmbr3.grid(column=2)
    nmbr4.grid(column=3)
    nmbr5.grid(column=4)
    nmbr6.grid(column=5)
    nmbr7.grid(column=6)
    nmbr8.grid(column=7)

    return frame

#

for the moment, i have something like this

#

sorry if my code is terrible X), i'm like a beginner (but not too much)

#
def create_main_window():
    principal = tk.Tk()
    principal.rowconfigure(0)
    principal.rowconfigure(1)
    principal.rowconfigure(2)

    Frame2 = create_frame_cntr(principal)
    Frame2.grid(column=0, row=1)

    principal.mainloop()
#

i've given the essantial

#

ping me if you respond :)

lyric minnow
#

hiii

#

is there anyone to help about Tkinter pack() method

#

?

#

๐Ÿ˜ญ

hazy cosmos
#

hey what u need

#

as example if you have window of

hello world
whasapp?

and you pack label with text im great it will just do

hello world
whasapp?
im great

not realy useful tho since you cant realy control thing
way to space is do like

hello world!
*imagine we having label here but with no text*
whasapp?
*same here no text*
im great

so in reality its going to look like

hello world!

whasapp?

im great```
#

@lyric minnow

#

that realy the best way explain it in my opinion

lyric minnow
#

i donnt konw how to use pack()

#

@hazy cosmos

#

tkinter pack

hazy cosmos
#

oh

#

so like

#
hello_world = Label(root,text='Hello world')
hello_world.pack()
#

another way to do it is using the .pack() right after

hello_world = Label(root,text='Hello world').pack()
#

its .pack()

lyric minnow
#

i know it but i dont know args of it exmpale pack(expand = 1, fill = BOTH, ipadx = 209

#

@hazy cosmos

hazy cosmos
#

now you know๐Ÿ˜‰

lyric minnow
#

not perfect

#

where is the ipadx?

#

but thx a lot

#

and where are you from

winter umbra
#

padx is in the label or button or else, not in pack

lyric minnow
#

ipadx?

winter umbra
#

what is for ipadx ?

hazy cosmos
#

pack() also has padding options:
padx, which pads externally along the x axis.
pady, which pads externally along the y axis.
ipadx, which pads internally along the x axis.
ipady, which pads internally along the y axis.

winter umbra
#

oh it's for .grid()

#

@lyric minnow ipadx is for .grid()

hazy cosmos
#

no its also for pack

#

but realy learn place most useful

#

pack not useful at all

#

and im telling u this as a person who learnd the trio like 2 days ago

#

and now im not using pack

winter umbra
#

k

#

so, you think .grid() is better or there is something else ?

lyric minnow
#

oh no

#

i decided to use place

#

๐Ÿ˜„

#

its so easier

hazy cosmos
#

grid can be useful

#

but as example for this gui

#

that i made place is a life changer

lyric minnow
#

i looked for remove widets, there is person say to pack_forget, grid_forget bu he didnt say place_forget ๐Ÿ˜„

lyric minnow
#

this is the mine

hazy cosmos
#

i looked for remove widets, there is person say to pack_forget, grid_forget bu he didnt say place_forget ๐Ÿ˜„
@lyric minnow I use forget indeed

#

waowsss its so nice
@lyric minnow tnx

#

this is the mine
@lyric minnow nice what's the use for it

lyric minnow
#

for local
project competition

#

its part of noble project

hazy cosmos
#

Nice good luck

lyric minnow
#

thank you

hazy cosmos
#

What language is it

lyric minnow
#

Turkish

hazy cosmos
#

Nice

lyric minnow
#

where are you from

hazy cosmos
#

Rather not to saybrainmon

lyric minnow
#

o- ok

hazy cosmos
#

Maybe try and make the button more of ellipse

#

Like the square on middle screen doesn't look realy good

#

Ellipse should look great

lyric minnow
#

i like
rectangles

#

and i dont know how to make them eliipse ๐Ÿ˜„

hazy cosmos
#

Haha

#

So use rectangles

dusty scarab
#

TCL/tkinter RegExp issues:
I would like 1 regexp that can do all of the following:

  1. ("[ \t][ \t]+") Delete consecutive spaces/tabs
  2. ("^[ \t]+") Leading spaces/tabs
  3. ("[ \t]+$") Trailing spaces/tabs
  4. ("#.*$") Delete the contents of lines that start with the '#' symbol
  5. ("^$") Delete blank lines

Here are the current search strings I'm using:

Here is my current code:

    cur_index = "1.0"
    cur_end = tk.END
    match_length = IntVar()
    search_string = r"REGEXP" # Regexp search string (one of the above)
    while Decimal(cur_index) <= Decimal(cur_end):
        try:
            cur_index = editor_text.search(search_text, cur_index,
                count=match_length, regexp=True,
                nocase=1, stopindex=cur_end)
        except Exception as exp0:
            cur_index = ""
            print(f"search_text: {search_text};{exp0}")
            break
        if not cur_index or match_length.get() == 0: break
        next_index = "%s+%sc" % (cur_index, match_length.get())
        editor_text.delete(cur_index, next_index)```
solemn rock
#

hello!

modern marsh
#

Hi

solemn rock
#

Can some one help me to postion a frame
I want to have to frames, one next to the other

#

But, one of them gets lost

#

The right one is supposed to have a button under it

dusty scarab
#

You can use a Label() as a layout tool and then nest the other elements in 2 labels side by side

solemn rock
#

Thanks! I will look for it as I hadnยดt heard of it ๐Ÿ˜„

#

I am sorry i got confused

dusty scarab
#

This is how I can use .pack with labels, then .grid on the elements contained in the label

solemn rock
#

I've already heard of it

#

Okeey, I will try it out!
Thx a lot

#

Hey, I had a mistake, where I can't use grid on a topLevel where I have already used .pack()
I will share this portion of the code, I will really appreciate any help ๐Ÿ˜„

dusty scarab
#

Sounds like another nested Label situation

solemn rock
#
  splitSomeE = Frame(splitWindow, bg = "#CACECF", width = "150")
  splitSomeE.pack(anchor = 'w')
  
  Label(splitSomeE, text = "Separar un grupo de paginas\nen especifico", bg = "#CACECF").pack()
  Label(splitSomeE, text = "De:", bg = "#CACECF").pack()
  Entry(splitSomeE, font = ("Helvetica", 10), width = 15, textvariable = num1).pack()
  Label(splitSomeE, text = "Hasta:", bg = "#CACECF").pack()
  Entry(splitSomeE, font = ("Helvetica", 10), width = 15, textvariable = num2).pack()
  Label(splitSomeE, text = "", bg = "#CACECF").pack()
  splitSomeBtn = Button(splitSomeE, text = "Separar", relief = RAISED, bg = "#000000",
                fg = "#FAFAFA", font = ("Helvetica", 15), activebackground = "#11B0D8", command = lambda: splitSome_click())
  splitSomeBtn.pack()    
  
  # Splitall 
  splitAll = Frame(splitWindow, bg = "#CACECF", width = "250")
  splitAll.pack(anchor = 'e')
  Label(splitAll, text = "Separar todos los elementos del archivo\nen paginas separadas", bg = "#CACECF").pack()
  Label(splitAll, text = "", bg = "#CACECF").pack()
  splitAllBtn = Button(splitAll, text = "Separar", relief = RAISED, bg = "#000000",
                fg = "#FAFAFA", font = ("Helvetica", 15), activebackground = "#11B0D8", command = lambda: splitAll_click())```
#

It is still the same situation tho ๐Ÿ˜ฆ
Thanks for the help, it is my first time using Tkinter

dusty scarab
solemn rock
#

I will check it out!
Thanks once again

dusty scarab
#

I ran into weird issues where resizing the window changes depending on "when" certain things are added to the layout.

proven basinBOT
#

Hey @lyric minnow!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

โ€ข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

โ€ข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

junior swift
#

Hey, I made a management system and I want to implement it on GUI, can someone tell me where can I look for guidance on how to implement my system on GUI?
Any link or material that might be helpful?
GUI tkinter to be specific

dusty scarab
junior swift
#

thankss I'll look into it

digital rose
solemn rock
#

@dusty scarab Sorry for direct pinging, wanted to thank you, you did help me a lot!

dusty scarab
#

Order of adding widgets does matter.

molten forum
#

Is anyone here good with Tkinter? I have a problem.

dusty scarab
#

Read back a bit.

molten forum
#

I haven't found anything to do with what I'm experiencing...

dusty scarab
#

Did any of those videos on that channel help any?

molten forum
#

not really

dusty scarab
#

What's the problem?

molten forum
#

When I open a new window in Tkinter, I want a variable to appear. That I can do, but whenever I go to try and update the label, it comes up with an error. I'm trying to update it with an entry. I'm going to try something that I haven't thought of yet and see if that works.

dusty scarab
#

.config() is typically what you want to do after something has been added to the layout.

#

Also, an "Entry()" can be decorated to simulate a Label()

#

One of the videos in that channel does illustrate that.

molten forum
#

That problem is that it saying a variable doesn't exist when it does...

dusty scarab
#

tkinter uses Intvar(), StringVar() and DoubleVar IIRC when using vars with widgets.

#

And they have to be declared before they are used.

#

If using them in a function, you may have to use global to indicate that it outside of the function scope.

molten forum
#

I've tried everything I know. I'm going to sleep on it. I need a break. I appreciate the advice though

warm spire
#

anyone here knows kivy ?

digital rose
#

hi, I have a problem, using Text widget I want to configure the blue hughlighting lines when Ctrl + A (I send 2 screenhots before and after Ctrl + A)

#

I want to keep those blue lines, but let them select ONLY the text

#

instead of the whole lines

digital rose
digital rose
#

also you can change the font

#

F :(

#

yes

#

:(

mint cloak
#

@digital rose Why do i need that extra library?

sharp falcon
#

Iโ€™m using tinker. When I click on a button, how do I change a value when a button is clicked? Does it have to be global if I want to use it outside the function?

#

Th buttons command is to go to a function. I want to set a new value for a variable inside this function

tribal path
#

Could use Vars

mint cloak
#

@digital rose i am really confused

ionic moat
#

Does anyone know why PyQt5 doesn't raise errors? I know it runs in C++ but isn't that the same thing that OpenCV-Python does it? Like it raises non-python errors, so why not for PyQt5, it's like the same thing??

This makes it really really really hard to debug in PyQt5, so does anyone have any tips on debugging in it?

eager beacon
#

PyQt5 has error messages too. Not sure what you're talking about?

ionic moat
#

I don't get them?

#

The only sign of an error is the GUI crashing

#

nothing else

eager beacon
#

There are some runtime things that you probably aren't going to see an error for, but trust me.. it has plenty.

#

what are you doing that triggers a crash?

ionic moat
#

Just basic Python errors or Qt Errors

#

like hanging the event loop or mistyping a variable name

#

anything

#

the only way for me to get the error for Python errors is by putting a try/except statement in every function

#

but that only shows Python errors

#

not problems in Qt

eager beacon
#

you can install a message handler if you want to but the messages you see probably aren't going to be very easy to make sense of.

ionic moat
#

Okay and something else

#

how do I do this? I already got an answer for it but I didn't understand it well but they said to use a Queue

eager beacon
#

What am I looking at?

ionic moat
#

Alright, let me explain, so:

#

first, the main GUI (the bigger one in the middle)

#

it has a button called "Edit Image"

#

now if the lower combo box is set to Image Polishing, it should prompt the GUI on the right

#

the GUI on the right has a spinbox that asks for a number between 0 and 5

#

after they choose their number and press OK, it should return that value of the spin box back to function that the "Edit Image" button is connect to

#

if they press cancel on the right GUI, the value of the spinbox will just be 0 by default

#

if it's 0, then set it to 1

#

So ```

  1. Press "Edit Image" this button is connected to function1
  2. function1 waits for value from function 2 (function2 is connected to "OK" button in second GUI)
  3. After "OK" button is pressed, function2 sends value of QSpinBox from GUI 2 to GUI1, function1, the first button
  4. That function handles the rest```
eager beacon
#

Okay, so what is the problem you're trying to solve?

ionic moat
#

waiting on the OK button in GUI2 to be pressed in function1 (GUI1)

#

and sending the value

kindred estuary
#

In your code, is the dialog on the right created by subclassing QDialog? If so, use pyqtSignal() to emit a signal when the button is pushed.

#

It is a bit difficult to discern what is causing your issue without having an idea what your code looks like. What you are trying to accomplish should bea simple task.

digital rose
#

how can I place 2 (or more) widgets next to each other using pack()?

dusty scarab
#

Use .grid() in a Label() that you then .pack into the rest of your layout.

modern marsh
#

i guess

modern marsh
#

if that is what you are saying

hazy cosmos
#

@digital rose place is realy the key in my opinion

#

like first widget is 20 width so do .place=(x=20,y=100) and then for the second one .place(x=50,y=100)

#

and it will be next to eachother

austere dove
#

Anyone know how to style the scrollbar of a QTableView in QT Designer via stylesheets? Styling "QScrollBar" doesn't seem to work for me.

dusty scarab
modern marsh
dusty scarab
#

They are in the same window.

#

Compare line 952 to line 956 on that web page.

unique forge
#

how do I remove QSizeGrip from my PyQt5 app?

prisma citrus
weak rivet
#

How do I remove the border around a tkinter slider? I've been looking through the docs and I can't find anything

prisma citrus
#

@weak rivet sorry for the ping, but r u making a game or something?

weak rivet
#

@prisma citrus Simulation

#

and I found the answer to my question anyway

prisma citrus
#

@weak rivet oh ok cool, btw I would love to try out yr game

weak rivet
#

It's not a game, and it's not really that good

#

and it's not finished

prisma citrus
#

Oh ok

dusty scarab
#

If that designer worked with VSCode, I'd be interested.

dusty scarab
#

The one you posted a link to just a few minutes ago?

prisma citrus
unique forge
#

how do I remove QSizeGrip from my PyQt5 app?

ivory ember
#

cant you just hide it

#

or style the window so its frameless

unique forge
#

doesnt work

unique forge
#

thats why I want to remove it

ivory ember
#

hmm

unique forge
#

its a frameless window with a sizegrip floating

ivory ember
#

can i c a screenshot

unique forge
#

one sec

#

@ivory ember

ivory ember
#

tf

#

and u said the window hints include frameless

#

maybe its something with your stylesheet

#

did u set a widget for the QSizeGrip

#

if you did, remove it

unique forge
ivory ember
#

is the ui made with designer or through code

unique forge
ivory ember
#

its possible the designer automatically adds it

unique forge
#

nope

#

nothing

#
        self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
        self.setWindowFlag(QtCore.Qt.MSWindowsFixedSizeDialogHint)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
``` this is the code to make it frameless
ivory ember
#

maybe try turning off translucentbackground?

unique forge
#

ok

#

nope

#

this is the window without a translucent background

dusty scarab
#

Looks like some sort of gradient is enabled.

unique forge
#

im just trying to remove the QSizeGrip

ivory ember
#

i still think its something to do with making it in designer

#

when i open it and create a mainwindow layout

#

the QSizeGrip is there

unique forge
#

any idea what to do

dusty scarab
#

You have to make the window NOT resizeable

unique forge
#

setFixedSize?

#

hello?

#

@ivory ember does setFixedSize make it not resizable?

ivory ember
#

o

#

mb

#

ummm

#

i think

#

i mean just try it

#

i always make my apps in code

#

never see the qsizegrip

#

something with designer

dusty scarab
#

In tkinter, the option is WindowObject.resizable(False, False)

#

One param is for the X/horizontal direction and the other is for the Y/vertical direction

silver widget
# ivory ember never see the qsizegrip

The designer puts a menubar at the top, and a message bar at the bottom for the mainwindow template. I believe those lines (and the entire bottom margin) are because of that.

silver widget
unique forge
#

lines?

#

im talking about the QSizeGrip

#

at the bottom right corner

silver widget
#

Yeah, those lines are the indicator for it.

turbid lava
#

Does anyone have experience using Dash to create data tables and geolocations.

peak cove
#

i have a bit of an issue with Curses so far.

#

so i have this window here, and it is about to be filled.

#

once i attempt to draw more than 63 characters inside of it, addstr will error.

#

is there a way to have things stored in the window, but only render a bit of?

#

actually you know what, i could store the text in a list, and only render segments of it in the window.

digital rose
#

Does anybody know what this means?

#

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Micha\AppData\Local\Programs\Python\Python38\lib\tkinter_init_.py", line 1895, in call
return self.func(*args)
File "C:/Users/Micha/PycharmProjects/restartebaybot/main.py", line 55, in startbot
timeing = int(input(self.box2.get()))
ValueError: invalid literal for int() with base 10: ''

#

@dusty scarab

dusty scarab
#

Peel back that onion a bit by separating out that line into different variables:

boxget = self.box2.get()
boxinput = input(boxget)
boxint = int(boxinput)
timeing = boxint```
And then see where the error falls.
digital rose
#

But I also have this self.box2 = Entry(root, width=50, bg="white", fg="black")

#

@dusty scarab

dusty scarab
#

With errors like that, get rid of the nesting first and troubleshoot from there.

digital rose
#

What is nesting? Putting everything into one line?

dusty scarab
#

Example of nesting from your code:
timeing = int(input(self.box2.get()))

digital rose
#

Oh okay. Thanks again for the help!

#

I will try this out.

placid valve
#

hi!

#

i was wondering if anyone knew how to implement something where after you print a selection e.g:

selection = input(f'{Fore.MAGENTA}Enter Choice {Fore.WHITE}-> ')
if selection == '1':
        clear()
        jokes()
elif selection == '2':
        clear()
        rules()
elif selection == '3':
        clear()
        upbcredits()
time.sleep(1000)

and u enter 1,2,3. it will print the desired text, but will add an option to go back to mainMenu()

#

e.g: it will print Press Enter To Return To The Main Menu and it will do that. i dont know how to implement it though

sinful chasm
#

Could someone know whether a pyqt5 project can be started with systemd? (Ideally using after=graphical.target)

prisma citrus
#

How to set the background image of the root window in Tkinter?

hidden dock
#

class UserInfoWidget(BoxLayout): def browse_file(self): subprocess.run(['powershell.exe', '"%s"' % os.path.join(os.getcwd(), "filebrowser.ps1")]) I am trying to open a file select dialoog on windows. When I run that file by opening powershell I get the file select but I don't get a select popup window with subprocess

#

I m using kivy

#

all I get is that string in shell

tribal path
#

try adding shell=True perhap?

placid valve
#

how to implement something where after you print a selection e.g:

selection = input(f'{Fore.MAGENTA}Enter Choice {Fore.WHITE}-> ')
if selection == '1':
        clear()
        jokes()
elif selection == '2':
        clear()
        rules()
elif selection == '3':
        clear()
        upbcredits()
time.sleep(1000)

and u enter 1,2,3. it will print the desired text, but will add an option to go back to mainMenu()
e.g: it will print Press Enter To Return To The Main Menu and it will do that. i dont know how to implement it though

frosty copper
#

Guys i need something EASY but POWERFUL:
ALOT of customization
Easy to understand GRID
Modern Design possibilities

prisma citrus
#

!pypi keyboard

proven basinBOT
#
Author

BoppreH

Summary

Hook and simulate keyboard events on Windows and Linux

License

MIT

peak cove
#

i love Keyboard and all, but it unfortunately requires superuser privileges on Linux.

#

which is quite a drawback in my opinion since it makes your application look really suspicious.

ivory ember
#

i would use the pyautogui module though the keyboard one is good too

#

!pypi pyautogui

proven basinBOT
#
Author

Al Sweigart

Summary

PyAutoGUI lets Python control the mouse and keyboard, and other GUI automation tasks. For Windows, macOS, and Linux, on Python 3 and 2.

License

BSD

magic seal
#

!pypi mouse

proven basinBOT
#
Author

BoppreH

Summary

Hook and simulate mouse events on Windows and Linux

License

MIT

onyx hawk
#

ok so i have a large confusion. this is my first time using pyqt5 and i want to change a value upon the press of a button.

from PyQt5.QtWidgets import QPushButton

progv = 0
#there are the other things needed for making the window here
def changeval(current, moreless):
    if moreless == "up":
        current = current + 1
        return current + 1
    elif moreless == "down":
        current = current + 1
        return current - 1
    else:
        print("ERROR")

#then i have my buttons... this is where i start getting confused.
upbutton.clicked.connect(changeval(progv,"up"))
downbutton.clicked.connect(changeval(progv, "down"))
#this returns "TypeError: argument 1 has unexpected type 'int'"
#so to my understanding, it can only use a callable function, so how would I make it change the value of [progv]???

anyone have any idea?

#

the current = current [operator] 1 section is also confusing

ivory ember
onyx hawk
#

awesome

#

also i have the buttons implemented, just left that out of the code i sent

ivory ember
#

add it

#

might as well

#

i should be don by tomorrow

onyx hawk
#

oh, ok

#

i was more wondering how

#

but

#

ok

#

i can problobly just read over it to see how

#

I think i figured out the designer.exe
I think it should be easy enough from here

ivory ember
#

ill add comments so u learn not just copy the code

onyx hawk
#

alright

buoyant kiln
#

hey anyone, I'm looking for a module to print to terminal "the value of X is " + x

In this print I want to loop through a few functions which will continuously change the value of X.

I dont want to reprint the entire string at the end of the loop. I want a terminal entry that prints "the value of X is " once, but continuously updates x

waxen wadi
#

Hello, I'm using Tkinter, and I'm working on a virtual keyboard.

#

Is there a way to always keep the focus on the keyboard and the user application

#

And can I make a virtual keyboard event (like a keyboard press but virtual)

dusty scarab
waxen wadi
#

๐Ÿ‘€

#

I'll take a look

#

Seems interesting

dusty scarab
#

The common code between all of my dialogs are what you are looking for. The TODO dialogs may be easier to understand.

modern marsh
#

binds and focus_force() i guess

ivory ember
onyx hawk
#

I'll take a look when I get home. Thanks.

ivory ember
#

np amigo

ivory ember
#

umm, does anyone where to find UI programming paradigms

#

like MVC (model-view controller)

ivory ember
dusty scarab
#

I think there is also an MVVM model too. I still don't understand that one.

ivory ember
digital rose
#

Hello so, I am trying to launch my discord bot using a tkinter button but whenever I press the button my app crashes

#

The bot does launch but my GUI crashes

celest sun
#

does it produce an error message?

digital rose
#

no it just doesn't respond

#
import tkinter as tk
import os
from main import TOKEN
from main import client

root = tk.Tk()
root.title("Discord bot")
root.resizable(False, False)

canvas = tk.Canvas(root, height=700, width=700, bg="white", highlightthickness=0)
canvas.pack()

frame = tk.Frame(root, bg="black")
frame.place(relwidth=0.8, relheight=0.05, relx=0.1, rely=0.03)


def launch_bot():
    client.run(TOKEN)


launch_button = tk.Button(root, text="Run", command=launch_bot)
launch_button.pack()


root.mainloop()

this is the code

meager spoke
#

How to change focus to next widget when user press enter instead tab in PySide 6?

red sapphire
#

Hey guys, I'm about to finish my uni Python course and I'm looking for a fun way to test my skills with a project. Decided to make a text-based RPG game. I've got all the necessary skills down but one thing I'm concerned about is having everything in a console window (rudimentary, ugly, problems across operating systems).

If I want to make a simple GUI for displaying text in a somewhat richer way than a console window, do you guys have any recommendations for where to start?

#

I suppose this might be an extremely basic question for this channel!

digital rose
#

@red sapphire I would recommend using Tkinter

red sapphire
#

I'll look into both, thanks!

red sapphire
#

Ahhh boy, this is taking me back to the Flash days

#

Looks like I'll be diving into event listeners and whatnot again

red sapphire
#

the Qt licensing makes me a little bit uneasy

unique forge
#

@red sapphire look at PySide2

#

PySide is basically PyQt but with better licensing

red sapphire
#

๐Ÿ˜ฎ

#

Looks fantastic!

#

Seems the consensus is that the only downside of PySide is that it is not as actively developed as PyQt, but for something super simple like what I'm doing, it shouldn't matter at all

#

I figure there's always a chance that I'll develop something cool and want to distribute it, without wanting to spill the code guts, so the LGPL license makes up for anything

dusty scarab
#

For an unbiased review of all the Python GUI tools: https://www.youtube.com/watch?v=nBkU6TEZ_BI

Choosing the best Python GUI Library: Kivy, PyQt, PyGui, WxPython, Tkinter. 5 Things to consider, pros, and cons of each library.

In this video, you will be able to choose between the most popular Python GUI libraries. You will:
-Learn about Kivy
-Learn about PyQt and PyQt5
-Learn about WxPython
-Learn about Tkinter
-Learn about PyGU...

โ–ถ Play video
dusty scarab
#

What I learned about tkinter I learned from https://www.youtube.com/c/Codemycom/videos

digital rose
#

The bot does go on

dusty scarab
#

Go through his videos about buttons and commands. See what happens.

digital rose
#

I think it has something to do with threading tho I dont understand that one

dusty scarab
#

He covers that too.