#user-interfaces
1 messages · Page 54 of 1
do you know any gui designers for beginners?
nvm yeah it doesn’t
Hey! why the quit function(Tkinter) does not work when i run the program through my python file? when i run the program through cmd the quit button works🤔
https://dpaste.org/hMyi my code!
PS :- Don't review the appearnace
@fluid tinsel pyside2 is lgpl, so if your code is open source it's fine
Stuff gets a bit weird when you want it closed source but with pyside2, if you do it correctly you can keep your specific code closed
@ionic forge what do you mean by "when you run the program through your python file"?
I mean by pressing F5 from the python file.
And the issue got solved idk how! Nvm
yeah it kinda won’t be so I won’t use it.
might write my own module using ctypes
can you assign a bind to multiple functions in tkinter
you will either need to specify a function that calls all of those on their own or run the bind command multiple times with the add arg set to True
@static cove can you help me with making a global variable, Im still stuck on trying to do the listbox stuff
def LB():
f = str(listbox.get(listbox.curselection()))
print(f)
def F():
f = ""
if root.focus_get() == entry1:
EL()
print("EL")
elif root.focus_get() == entry2:
L()
print("L")
elif root.focus_get() == entry3:
W()
print("W")
print(W())
elif root.focus_get() == entry4:
H()
print("H")
elif root.focus_get() == entry5:
V()
print("V")
elif root.focus_get() == entry6:
M()
print("M")
A = ""
B = ""
if f == "Length":
A = str(v / (w * h))
if f == "Width":
A = str(v / (l * h))
if f == "Height":
A = str(v / (l * w))
if f == "Area":
A = str(l * w)
if f == "Mass":
if l != "" and w != "" and h != "":
v = (l * w * h)
A = str(d * v)
if f == "Volume":
if l == "" or w == "" or h == "":
A = str(m / d)
print(A)
else:
A = str(l * w * h)
label8['text'] = A
if A == B:
label8['text'] = "Error, Not Enough Entries"
elif f == "":
label8['text'] = ""
Why doesnt f get assinged the value globally
I tried global f and nothing
void function that's not returning anything
So what do I return in order for f to be the list box output
I’m binding this to click in side of the listbox btw
Mind posting code? I'll compile on my side
also try not to use same var names in different functions, makes it very confusing
its 200 lines
def F(*args):
f = str(listbox.get(listbox.curselection()))
return f
def callback(event):
if root.focus_get() == entry1:
EL()
print("EL")
elif root.focus_get() == entry2:
L()
print("L")
elif root.focus_get() == entry3:
W()
print("W")
print(W())
elif root.focus_get() == entry4:
H()
print("H")
elif root.focus_get() == entry5:
V()
print("V")
elif root.focus_get() == entry6:
M()
print("M")
A = ""
B = ""
if f == "Length":
A = str(v / (w * h))
if f == "Width":
A = str(v / (l * h))
if f == "Height":
A = str(v / (l * w))
if f == "Area":
A = str(l * w)
if f == "Mass":
if l != "" and w != "" and h != "":
v = (l * w * h)
A = str(d * v)
if f == "Volume":
if l == "" or w == "" or h == "":
A = str(m / d)
print(A)
else:
A = str(l * w * h)
label8['text'] = A
if A == B:
label8['text'] = "Error, Not Enough Entries"
elif f == "":
label8['text'] = ""
root.bind('<Key>', callback)
here is the neccessary part
im trying to get f into the callback function
thats why its the same variable name
I want f to be a global variable, but
global f
Doesnt work
@timid ether
add a parameter to callback
called f
im not too versed with tk so dunno about the internal logic
paste and share
ye trying to make some sense of tk
The function logic works now play around with the checks that you don't divide by 0 and so on
@dark gulch
Dilove hi
hello
?
I am there
Ok
@dark gulch, you can bind multiple events with a parameter to bind add="+". This was really hard to find out btw.
oh i guess he said add=True works; i read it saying like this
What’s a good library for UI ?
pyqt5 is nice
Probably pyqt but it can be a real headache if you want some tiny changes
hey guys, i wanna know how to draw a separator line in pyqt designer? like this
hey guys, i wanna know how to draw a separator line in pyqt designer? like this
@digital rose
Make a qframe
yeah i did
Whats the easiest GUI framework for making an app like discord?
i mean with the complex mordernish style
@digital rose Probably kivy since it has kivymd. Are you looking to do this to learn a GUI framework or for some other reason?
what is kivymd?
kivymd is a set of widgets using material design that you can use with kivy. It has modern styling out of the box
ah neat
I wish PySide or PyQt had something like that
the closest I've found is QtModern and that's just a styled window widget
how to make a "do you wish to save" message box on tkinter which can save and exit if you click yes, not save and exit if you click no and cancel if you press cancel?
i know how to make the message appear but idk how to make it save or not
Hey just a really simple Question, How do you Open a Qdialog from Main window Upon pushing a button
In PyQt
use QDialog.exec_() instead of show
like this?
by the way i have the Qdialog class in separate file, (yes i'm importing it like from settings_dialog import Ui_Settings_QDialog)
if you have a UI file you should subclass QDialog and inherit Ui_Settings_QDialog
@digital rose tkinter.messagebox.askyesnocancel will do just that and return True, False or None. This will however create a default dialog for the system; if you want to have more control over it, you will need to create a custom dialog involving tk.Toplevel
@digital rose
tkinter.messagebox.askyesnocancelwill do just that and returnTrue,FalseorNone. This will however create a default dialog for the system; if you want to have more control over it, you will need to create a custom dialog involving tk.Toplevel
@amber roost how do i test if its value? do i just doif tkinter.messagebox.askyesnocancel is True?
you'll have to call it, where it will block the program completely until the user clicked one of the buttons
the return value will correspond with the selected button
ok it worked now
hey, does anyone know how i can transfer variables between frames in tkinter?
nvm got it
how did you do it?
***Do anyone know Tkinter good??
If yes DM me***
@modern folio what's your Tkinter question?
go to https://www.tkdocs.com and check out the tutorial
it's best if you ask specific questions, just "learning Tkinter" is way too broad
learn from them
there is a lot to learn and you really need to build up from basic principles
same with any GUI system
you need to describe it better, I don't know what you mean
there is a window, when u left click, it prints left click in terminal, if you right clcik it prints right click in terminal, and if you middle click, it prints middle click in the terminal
if that's all that the app does, it's just a basic example of using the mouse, which is a good first step
did that come from a tutorial?
was that the whole tutorial, or is there more?
so now you need to find another tutorial to take the next step
the TKDocs one is very good, there are probably simpler ones
that's great, that's the way to do it
thenewboston this is his channel name
yes, he's good
🙂
go through the basics and get more comfortable about it, then start some simple projects of your own and come here and ask when you have specific questions
sure
that's really the best way to learn it
can i add you as a friend
yes you can
sent you friend request
accepted
🙂
good luck with it, I have to go for tonight, but will be on tomorrow
where are you?
okay, 9 hours ahead of me so like timezone + 5 maybe?
i guess
we'll connect when we can, but ask specific questions here and people can help
what is your WPM
?
words per minute
never measured it, but I type with most fingers and can go pretty fast sometimes
decent, keep practicing! for me it makes a big difference if I'm sitting up correctly! 😆
okay, gotta go but good luck!
wait a min
quickly
bro
first test of the day
so
got
it's good enough if you can type well, you don't need to compare your number to anyone
the backspace is my favorite key, but I get what I need said
mine is backspace and space
so I probably won't take that test, definitely not tonight
lol
there all good keys! 🙂
if yours is a mechinical keyboard, don't take the test
I won't! Good night Techno!
GoodNight @noble kite
flex
hello
does anyome know how do i connect js
with a py script
bcuz i want a js ui
ok thx
hello is there a good eel tutorial
I was looking into wxPython since it seems interesting, what are some good resources for it?
I’ve already read the realpython tutorial, and tried reading the official documentation, what other resources are there?
Hi, so i wanna Know How do you access a Push button in Qdialog from Your main window?
i tried like this but it doesn't work
self.dialog = Ui_Settings_QDialog()
self.dialog.connect_btn.clicked.connect(self.serial_connection)```
oh and im using PyQt5
code
Guyssss
show me code in a codeblock please
@digital rose don't blame me but idk what that even is
im trying to learn django. it installs but it wont start the development server
ah ok
Goto #web-development @charred comet
yea'
i wanna Know How do you access a Push button in Qdialog from Your main window?
i tried like this but it doesn't work
self.dialog = Ui_Settings_QDialog()
self.dialog.connect_btn.clicked.connect(self.serial_connection)```
and im using PyQt5
🥺
Hey guys, I know a pretty good amount of python but all I do works on the command line, I want to create actual GUIs and I am not talking about the ones like TKinter but actual interfaces like that of Premiere Pro or Discord itself, I assume that would require to learn a front-end language, please guide me in the following. (Originally posted in questions but lead here)
Discord is an electron app. You'd need to know javascript/typescript for that. Premier Pro is built using the platforms native libraries which you can't do easily with Python. If you use pyqt5 you can create the entire app in ython and style it with CSS
You can make discord like app with pyqt5 but you must put some effort to do it
what do you mean @trim oak
Can you give a specific example?
Any idea of how to implement a time picker like this in PyQt5? I tried QDateTimeEdit but that didn't really give me what I was looking for
Also if anyone has any suggestions on closing a window when a button is pressed that would also be nice
just do self.yourbutton.cliicked.connect(lambda: self.close()/window.close())
@silk basin
there isnt a self.close()?
hmm
'QVBoxLayout' object has no attribute 'close'
@bronze basin
So I have my QVBoxLayout called:
self.l1 = QVBoxLayout()
self.done = QPushButton("Done", self)
self.done.clicked.connect(self.l1.close)
self.l1.addWidget(self.done)
Yeah that's what I tried to do but for some reason it simply wont work :/
QVBox isn't your window
Remember, you can't see a QLayout without a QWidget
@silk basin and as far as the time picker goes you said you tried QDateTimeEdit.. why not QTimeEdit?
@silk basin and as far as the time picker goes you said you tried QDateTimeEdit.. why not QTimeEdit?
@eager beacon That did indeed work
Also so this is a different popup than the calculator
self.thatWidget.close()
aw thanks pal
I am just going to tinker with that QTimeEdit now
I would like it a list but its only showing one time slot at a time
I want it like the picture I sent above
I thought of that well see
I'll probably implement both methonds and then test to see which is better
a dateTimeEdit does inherit the QAbstractCombo so you could customize it but it would probably be a ton easier to just make a comboBox
!e
hours = list('123456789') + ['10','11','12']
minutes = ['00','30']
periods=['AM','PM']
for period in periods:
for hour in hours:
for minute in minutes:
time_ = f'{hour}:{minute} {period}'
if int(hour) < 5:
print(time_)
break
You are not allowed to use that command here. Please use the #bot-commands channel instead.
aww 😦
either way
just take out everything below time_
and add time_ to the combo
you might want to create an actual datetime.time object first
ohh bet
I can definitely use that
Thank you, while I have you, you wouldn't happen to know how to include a warning message for that done button would you?
Should I use QDialog
I now want a warning that says, if an assignment has not been added and the user clicks "Done" I want a warning to ask to make sure they are aware they have not added an assignment if they are sure they want to continue.
I already set a trigger inside of Add Assignment that sets the trigger to 1 when an assignment has been added. I just need a way of the error message popping up. @eager beacon
Is it a warning or a confirmation
I guess confirmation
Let me give that a shot
@eager beacon
def Close(self):
if self.global_trigger == 0:
print("000")
self.message_box = QMessageBox()
self.message_box.setText("Are you sure you want to quit without adding any assignemnts?")
self.message_box.setStandardButtons(QMessageBox.Yes | QMessageBox.Cancel)
else:
self.pop.close()
It is entering the if statement but it isn't bringing the QMessagebox
what can i use for authentication with google and through email and password?
it's because you haven't opened it
you need to use exec_() to show it iirc
@delicate latch google-auth works
ok.. though @eager beacon i need to connect it in some way with firebase
how do you need to interact with firebase?
you'd probably be better off looking for a firebase python plugin from google
99.99% chance it includes an auth function somewhere in it
def Close(self):
if self.global_trigger == 0:
print("000")
self.message_box = QMessageBox()
self.message_box.setText("Are you sure you want to quit without adding any assignemnts?")
self.message_box.setStandardButtons(QMessageBox.Yes | QMessageBox.Cancel)
return_value = self.message_box.exec()
if return_value == QMessageBox.Yes:
self.pop.close()
else:
self.pop.close()
Yep! this worked.
yeah
If user clicks yes it will close everything. if user clicks cancel it will return them to the add assignment widget
yeah, that's the benefit to using the message box over making your own dialog
you can even add fun little icons
yeah I see that
my partners made a whole ass dialog adder function but is way too complicated
this method is way better
@eager beacon i need a database though...
I don't understand what the problem is
there is an auth example in the first code block
@silk basin what did they make?
whats the command that allows me to post long code
Also @eager beacon can I explain my plan and then you tell me if I should 100% do this a different way or I have the right idea lol
!code
Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.
To do this, use the following method:
```python
print('Hello world!')
```
Note:
• These are backticks, not quotes. Backticks can usually be found on the tilde key.
• You can also use py as the language instead of python
• The language must be on the first line next to the backticks with no space between them
This will result in the following:
print('Hello world!')
So I have what I call an assignment adder. This allows the user to input details about an assignment they have.
okay I'm with you so far
This is the information I grab from the user input (still working on time)
So what I need to do is get this organize it and set almost like a physical list this will be implemented into our GUI that will have all the assignments in order based on date/time along with ofcourse having the name and class next to the assignment
What I was planning on doing is using Pandas loading all the data I have for the assignment and implementing this sorting algorithm to allow me to output in the GUI an ordered list of up coming assignments and names. What do you think?
The only issue thusfar is I need a way for storing assignments even after the program is closed that way when the user opens up the program their assignments are still there(This method I have yet to think of)
how are you storing the assignments?
lol
yeah...
well
is that the only widget a user can use to add info for an assignment?
yeah I will need to make a way in the future of editing an assignment but thats for a later problem
if you want to keep it simple you could append every entry to a csv file and sort by the date column before adding it to a listWidget
That is exactly what I was thinking
after sorting I would add in slot i of the list, date, name, class, and time and then print that out.
you think thats the best way of going about that?
tablewidget
same concept
the difference is a list widget has 1 column table widget has as many as you want
Yeah bet. That makes sense
create an empty csv file if it doesn't exist when you start the app and use 'a' when you go to save it after the popup is closed
yeah bet
i mean with open('assignments.csv','a') as file:
I can definitely do that
sounds easy enough
Lol well see when I am sitting here trying to figure it out
we get to demo our project tomorrow though so i am excited
from ui_Register_Window import Ui_MainWindow
import sys
from PySide2.QtWidgets import QMainWindow, QApplication
from Firebase import FirebaseManager
from PySide2.QtGui import QMovie
class RegisterWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.registerButton.clicked.connect(self.register)
def register(self):
manager = FirebaseManager()
name = self.ui.usernameField.text()
emailID = self.ui.emailIDField.text()
password = self.ui.passwordField.text()
confirm_password = self.ui.confirmField.text()
if password != confirm_password:
self.ui.errorMessage.setText("Passwords do not match.")
self.ui.errorMessage.show()
manager.registerUser(emailID, password, name)
app = QApplication(sys.argv)
window = RegisterWindow()
window.show()
sys.exit(app.exec_())
i am trying to call this register windows from an initial screen when the person preessed the button
from ui_Initial_Window import Ui_MainWindow
import sys
from PySide2.QtWidgets import QMainWindow, QApplication
from Firebase import FirebaseManager
from PySide2.QtGui import QMovie
from Register import RegisterWindow
class InitialWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.movie = QMovie("space.gif")
self.ui.label.setMovie(self.ui.movie)
self.ui.movie.start()
self.registerButton.clicked.connect(self.show_register_screen)
def show_register_screen(self):
dialog = RegisterWindow()
dialog.show()
app = QApplication(sys.argv)
window = InitialWindow()
window.show()
sys.exit(app.exec_())
however, when i run this, i get the register screen, not the initial screen
Is the app/show code at the bottom from your testing or is that how it's set up in your IDE?
if it's like that then that code is going to run when you import RegisterWindow
if __name__ == "__main__":
app = QApplication(sys.argv)
window = InitialWindow()
window.show()
sys.exit(app.exec_())
do the same with RegisterWindow
@delicate latch
from ui_Initial_Window import Ui_MainWindow
import sys
from PySide2.QtWidgets import QMainWindow, QApplication
from Firebase import FirebaseManager
from PySide2.QtGui import QMovie
from Register import RegisterWindow
class InitialWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.registerButton.clicked.connect(self.show_register_screen)
def show_register_screen(self):
dialog = RegisterWindow()
dialog.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
window = InitialWindow()
window.show()
sys.exit(app.exec_())
this doesn't work either
you did the same in both files?
no..
oh
technically you only need the __main__ in the registerWindow but it's good practice
`` def multiMap(val, _in, _out, size):
if val <= _in[0]:
return _out[0]
if val >= _in[size - 1]:
return _out[size - 1]
# search right interval
pos = 1 # _in[0] allready tested
while val > _in[pos]:
pos += 1
# this will handle all exact "points" in the _in array
if val == _in[pos]:
return _out[pos]
# interpolate in the right segment for the rest
return (val - _in[pos - 1]) * (_out[pos] - _out[pos - 1]) / (_in[pos] - _in[pos - 1]) + _out[pos - 1]
multiMap(3, [0, 20, 40, 60, 80, 100], [0, 15, 43, 53, 75, 100], 100)``
can some one see what im doing wrong here?
im new to phyton
Is there a simple way to display a dialog window using tkinter?
Don't wanna create an entirely new Tk object for that
@oak portal "Simple" dialogs like those "Yes/No" or Info/Warning/Error messageboxes are supported by tkinter in tkinter.messagebox, but for other dialogs you'll need to create tkinter.Toplevel objects and call a series of focus rerouting commands on them.
how to make tkinter button accept coroutine???
In tkinter, if you create a tk object, and don't give it a frame, when you start running the main loop, does it create it's own frame object?
@oak portal no it just adds it to the parent frame, I'm fighting that now as well.

So what if you wanna create multiple windows? You just have to create a new Tk object?
I'm no expert by any means, I'm trying to use a class for a pop up window that is defined in a separate file and it just adds it the window that calls it. Trying to find the solution now. I'm sure there is someone on here that knows a lot more than me
Best I can tell you is yes
You should only create two Tk instances if you really know what you're doing, they both claim an entire thread and both access a tcl background system where they may overlap and disrupt eachother in some way
I managed to get what I wanted by creating a function that called the class and used a different tk.TK(). Is that the optimal way to do it?
@amber roost So how else would I create two windows without creating two Tk instances
And Frame is supposed to be put inside a Tk then?
I am confused 
I guess I could copy-paste the code I use here
Although to be honest these commands are just the result of trial and error until they worked; then I never touched them again
Basically in the one and only tkinter program i have all dialogs inherit from a common base dialog, which itself inherits from tk.Toplevel
And what's Tk.Toplevel?
I don't understand which class creates the window, if it's Tk, Frame, or whatever else class
tk.Toplevel is responsible for the window itself
Tk and Toplevel are similar in that fashion, but Tk is more than a Toplevel
Well, there must be some pythonic way to create multiple windows 
After the dialog is created, it needs to be explicitly brought up using a show method
def show(self):
"""Show the dialog."""
self.grab_set() # Events will only be routed to this dialog
self.focus_set() # Request focus to this dialog
#setup interface
self.rootframe = ttk.Frame(self)
self._mainframe = ttk.Frame(self.rootframe)
self.body(self._mainframe) # Overridden in subclasses
self._mainframe.pack(expand = 1, fill = tk.BOTH, padx = 5, pady = 5)
self.rootframe.pack(expand = 1, fill = tk.BOTH)
self.withdraw() # Creates the toplevel, but in a hidden state
# configure some stuff, this is copy-pasted from tkinter.simpledialog iirc
if self.parent.winfo_viewable():
self.transient(self.parent)
if self.parent is not None:
self.geometry("+{}+{}".format(self.parent.winfo_rootx() + 50,
self.parent.winfo_rooty() + 50))
# show on screen
self.deiconify()
# wait until self is visible
self.wait_visibility()
# wait until self is destroyed
self.wait_window(self)
To be fair, I have no idea if wait_visibility or withdraw are neccessary
I think wait_window and the entire grab_set thing may also be replaceable with mainloop in some sense
I'll try around a bit
Hmm
yeah, still works just as fine without withdraw, deiconify and wait_visibility
you want wait_window though, in my case the main program continues running alongside with the dialog otherwise and screws up its config
I'll have to look at the docs because I don't know half of those methods
It seems that replacing the wait_window thing with mainloop is a bad idea as well, since the code that should run after the dialog is closed just doesn't anymore
however the invoking code atm looks like
dialog = Settings(self.root, ...)
dialog.show()
```, while it probably should be
```py
dialog = Settings(self.root, ...)
dialog.show()
self.root.wait_window(dialog)
```, since it makes no sense the dialog is waiting for itself to be destroyed
It works, but ... feels off
also an interesting thing i noticed, if a button is responsible for opening up dialogs and you spam Space on it super fast, it opens 2 dialogs for no reason
maybe i should report that issue to the poor soul that still maintains tk today
What does the Tk.mainloop() run? 
Simplified, it runs the window. Nothing will run without it
But what's inside 
I was thinking that it might be doing something like
while True:
self.windowfunction()
So that you can take that function and run multiple of them
has anyone had success in installing kevi?
@true harbor what version of python are you trying to install Kivy on?
@oak portal you mean what's inside .mainloop()?
@true harbor what version of python are you trying to install Kivy on?
@static cove not sure, im trying to download it on pycharm and this is the error
also, is there a better gui library that you know? i just choose the first one that had decent documentation
@true harbor Can you go to File -> Settings -> ProjectName -> Project Interpreter and take a screen shot of that window?
@static cove not sure, im trying to download it on pycharm and this is the error
also, is there a better gui library that you know? i just choose the first one that had decent documentation
@true harbor i assume this is the version?
Ah, okay
@true harbor Can you go to File -> Settings -> ProjectName -> Project Interpreter and take a screen shot of that window?
@static cove
You want to run this command to install it:
py -m pip install --pre --extra-index-url=https://kivy.org/downloads/simple kivy[base]
oh just do pip install --pre --extra-index-url=https://kivy.org/downloads/simple kivy[base] then
oh just do
pip install --pre --extra-index-url=https://kivy.org/downloads/simple kivy[base]then
@static cove seems to be work, will try runnig kivy to test
@oak portal you mean what's inside .mainloop()?
@static cove Basically. I am trying to figure out how to make multiple windows
You can't tell me that the creator(s) of tkinter didn't think about that
@oak portal use Toplevel()
mainloop() starts the Tk() instance, of which there should only be one
And what is Toplevel and what does it do 
It's not? It's like a Frame but it's top level instead of being a child
That conflicts with what the site you just sent me says
It doesn't
The Toplevel widget work pretty much like Frame, but it is displayed in a separate, top-level window. Such windows usually have title bars, borders, and other “window decorations”.
@static cove seems to be work, will try runnig kivy to test
@true harbor it works, thank you so much
Nice
It does
The Toplevel widget is used to display extra application windows, dialogs, and other “pop-up” windows.
@true harbor and also check out kivymd for material design widgets you can use if you don't now about it yet
ok, thanks
Well, it works for what my intended purpose is
Do you not want other application windows?
Toplevel is what gets you multiple windows
It can just also be used for dialogs and pop-ups
Because those are also, technically, other windows
Does it disable the original window?
Nope, but you can hide/show the original window as necessary
there is PyQt @true harbor
@bronze basin where would i find the docs for that?
@true harbor PyQt is a binding of a C++ library, so the source documentation is in c++. There are the pyside2 documents, which tries to convert the docs to use python syntax, but it's not the greatest
ok, what library would you recommend for begginers?
Okay, last question, Frame still needs a Tk, right?
Your tkinter program should always have a Tk() instance as that is what runs your GUI. But it should almost always only have 1 Tk() instance
@true harbor I would give kivy a shot, I don't have a lot of experience with it but it's pretty nice from what I've seen
@true harbor I would give kivy a shot, I don't have a lot of experience with it but it's pretty nice from what I've seen
@static cove ok, any else?
Okay okay, probably last question, what's the difference between super and super()? 
Super() returns what the class is inheriting from 
I'm trying to make a frame have the same size as the original, but it just ain't working
from tkinter import *
class main(Tk):
def __init__(self):
super().__init__(className=" Blackjack ")
self.frame()
self.geometry("300x300+50+50")
self.mainloop()
def frame(self):
self._f = Frame(bg="black", width=self.winfo_width(), height=self.winfo_height())
print(self.winfo_width())
self._f.pack()
Took some time, but you gotta give the .pack() arguments expand=1, fill="both"
Help me in #🤡help-banana
Hi
if anyone knows QT
or
QT Designer
please answer my stack overflow
@rotund flax
@vast grove @foggy junco
I am having trouble setting window icon in tkinter, I am not sure what function to call
Google more or less returned non-existent functions
Do I have to specify where it is, even though it's right next to the .py file?
what does your code look like now for setting the favicon?
self.iconbitmap(self.PhotoImage(file='ace_of_spades_t.png'))
Somewhere, I found this weird photoimage method 
Favicon?
@oak portal that window icon is usually called a favicon. So you load in the image you want. Usually with Pillow and then use the iconbitmap to point to that photo that you loaded in
Well that's annoying
hello?
I don't like using external libraries 
(I'm looking at your code, give me a minute)
oh sorry
@oak portal why?
Since the person then needs to have that library
Well, you'll need to use a GIF format then. Tkinter has a native PhotoImage function, but it only supports GIFs and PGM/PPm files. http://effbot.org/tkinterbook/photoimage.htm
Well, I just have to convert it to a .gif then 
@unique forge Could you post a picture of what the UI looks like? It'll make it a bit easier for me to explain how to structure your code
ok @static cove
mhm
and then you can do:
self.iconbitmap(file) and that shoooould work
Shouuuulllddddddd
self.icon = self.PhotoImage('ace_of_spades_t.gif')
self.iconbitmap(file=self.icon)
This didn't work
And I did try opening the file
...Does it actually have PhotoImage?
Okay, so each of those main buttons pulls up the next UI widget, which is good. Each of those UI widgets should have their own "Enter" buttons to run the required code. When the user presses the "Enter" button in the sub-widgets, you should get the values they entered in the LineEditWidgets associated with the sub-widget, and then run the code
@oak portal what does:
self.icon = tk.PhotoImage('ace_of_spades_t.gif')
self.iconbitmap(self.icon)
get you?
That explains it
I thought that PhotoImage was a function of Tk class
It doesn't get me anything
self.icon = PhotoImage('ace_of_spades_t.gif')
self.iconbitmap(file=self.icon)
This neither
are you doing from tkinter import * as your import
Ye
so don't do the file= in the iconbitmap, just put (self.icon)
from tkinter import *
class blackjack(Tk):
def __init__(self):
super().__init__(className=' Blackjack ')
self.icon = PhotoImage(name='ace_of_spades_t.gif')
self.iconbitmap(self.icon)
self.frame()
self.geometry('300x300+50+50')
self.mainloop()
def frame(self):
self._f = Frame(self, bg='#303030')
self._f.pack(expand=1, fill='both')
main = blackjack()
I am unsure why it doesn't work, because it does open the window
...
I have this weird feeling that it's running something different that I am thinking
There is literally a print statement that doesn't work, soooo... I might be running completely different file
Oh god
@static cove I'm so sorry, the whole time, I've been editing a completely different file with the same name
how do you add code snippets to discord?
!code
Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.
To do this, use the following method:
```python
print('Hello world!')
```
Note:
• These are backticks, not quotes. Backticks can usually be found on the tilde key.
• You can also use py as the language instead of python
• The language must be on the first line next to the backticks with no space between them
This will result in the following:
print('Hello world!')
'''python
so you need backticks, this: ` not '
where is the tilde key
It's above the tab key for me
Same for me, but I have to press right alt for it
import sys
from PyQt5.QtWidgets import (QApplication, QMainWindow,)
from PyQt5 import QtWidgets
import PTCGUI
class MainWindow (QMainWindow):
def __init__(self):
super().__init__()
self.ui = PTCGUI.Ui_MainWindow()
self.ui.setupUi(self)
title = ("Pythagorean Theorem Calculator")
self.setWindowTitle(title)
self.setFixedSize(16777215, 16777215)
done
it was above tab for me
This
from tkinter import *
class blackjack(Tk):
def __init__(self):
super().__init__(className=' Blackjack ')
self.icon = PhotoImage(file='ace_of_spades_t.gif')
self.iconbitmap(self.icon)
self.frame()
self.geometry('300x300+50+50')
self.mainloop()
def frame(self):
self._f = Frame(self, bg='#303030')
self._f.pack(expand=1, fill='both')
main = blackjack()
returns
_tkinter.TclError: bitmap "pyimage1" not defined
Is that gif file located in the same directory as your script?
Yes
If I remove file=, it returns
_tkinter.TclError: bitmap "ace_of_spades_t.gif" not defined
hmmm... so question, you're subclassing the Tk instance, why?
Well, my original thought process was that I could define the mainloop function so it runs another function during it, but at that time I did not realize that this was a dumb idea and that mainloop is a while loop
Basically, flawed logic lead to that monstrosity
aaaah, could you try this code? I'm curious if it's an oddity with the Tk() instance getting initialized wonkily
from tkinter import *
class blackjack():
def __init__(self):
self.root = Tk()
self.icon = PhotoImage(file='ace_of_spades_t.gif')
self.iconbitmap(self.icon)
self.frame()
self.geometry('300x300+50+50')
self.mainloop()
def frame(self):
self._f = Frame(self.root, bg='#303030')
self._f.pack(expand=1, fill='both')
main = blackjack()
I sure will
Btw I am running 3.9, just in case that's important
AttributeError: 'blackjack' object has no attribute 'iconbitmap'
is returned
okay, progress. Give me one second to pull up the docs again
self.iconbitmap(self.icon) --> self.root.iconbitmap(self.icon)
don't you need to inherit something?
So, I remade it without class inheritance
from tkinter import *
main = Tk(className=' Blackjack ')
main.geometry('300x300+50+50')
icon = PhotoImage('ace_of_spades_t.gif')
main.iconbitmap(icon)
main_frame = Frame(bg='#303030')
main_frame.pack(expand=1, fill='both')
main.mainloop()
If this is better
But it returns
_tkinter.TclError: bitmap "ace_of_spades_t.gif" not defined
What happens if you have the file= inside the PhotoImage?
is the file in your script directory?
Ye
have you tried using an absolute path?
What happens if you have the
file=inside the PhotoImage?
@static cove
_tkinter.TclError: bitmap "pyimage1" not defined
have you tried using an absolute path?
@eager beacon No I have not
So I tried an absolute path
Same error
I'd normally trust that, but the PhotoImage help file disagrees
one more thing to try:
icon = PhotoImage(master=main, file='ace_of_spades_t.gif')
For it to be an .ico you'd need to use PIL/Pillow
_tkinter.TclError: bitmap "pyimage1" not defined
mmmm... give me one second. I need to test something before I verify that this is what's causing the problem
root.iconphoto(False, tk.PhotoImage(file='/path/to/ico/icon.png'))
maybe that would work with a .gif
That returns a completely new error
_tkinter.TclError: wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"
@oak portal so running that code I am not getting an error unless I give it a non-existent file name
if you convert your gif to a .ico you don't need the photoImage
So are you sure that .gif file is in the same folder as the script you're running?
you just pass the path to iconbitmap
Lemme try renaming the file
You mentioned before you were running the wrong file with the same name, is that happening again?
Not this time
@static cove If I enter a non-existent file, it does return a different error, so it is finding the file
if you don't have a solid reason to use a .gif then convert it and try again
I only get this error: _tkinter.TclError: bitmap "pyimage1" not defined if I pass it a non-existant file. If I pass in a gif of the proper size it works. If I directly pass in an .ico file to the .iconbitmap() it works
do you have more than one Tk() running in that file?
Nope
But I just tried putting an .ico of the image into the thing
main = Tk(className=' Blackjack ')
main.geometry('300x300+50+50')
main_frame = Frame(bg='#303030')
main_frame.pack(expand=1, fill='both')
# icon = PhotoImage(file='ace_of_spades_t.gif')
main.iconbitmap("ace_of_spaces_t.ico")
main.mainloop()
Returns:
_tkinter.TclError: bitmap "ace_of_spaces_t.ico" not defined
And
main = Tk(className=' Blackjack ')
main.geometry('300x300+50+50')
main_frame = Frame(bg='#303030')
main_frame.pack(expand=1, fill='both')
# icon = PhotoImage(file='ace_of_spades_t.gif')
main.iconphoto("ace_of_spaces_t.ico")
main.mainloop()
Returns:
_tkinter.TclError: wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"
This is magical
run this in the same file
import os
print(os.listdir())
from tkinter import *
main = Tk(className=' Blackjack ')
main.geometry('300x300+50+50')
main.iconbitmap('ghost.ico')
main_frame = Frame(bg='#303030')
main_frame.pack(expand=1, fill='both')
main.mainloop()
This works for me, so I don't know what's happening on your end.
Returns:
['blackjack.py', 'ace_of_spaces_t.gif', 'ace_of_spades_t.ico']
t_T
ace_of_spaces
... yeaaaah
@static cove I know you are helping someone else but I need to get my app finished quickly
upload your image to google drive or something and send a link
@unique forge I gave you a suggestion on how I would approach it and didn't see anything else from you
otherwise I don't think I have anything else useful to add
So the code where you use the .ico file, you should change the file name to the correct one >_> @oak portal
@unique forge
#user-interfaces message
main = Tk(className=' Blackjack ')
main.geometry('300x300+50+50')
main_frame = Frame(bg='#303030')
main_frame.pack(expand=1, fill='both')
# icon = PhotoImage(file='ace_of_spades_t.gif')
main.iconbitmap("ace_of_spades_t.ico")
main.mainloop()
returns
_tkinter.TclError: wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"
And the name file is correct
I know that @static cove but I dont know QT5 very well so I dont know how to program it
if you have a tutorial maybe, that would help
print(open('ace_of_spades_t.ico','rb').read())
are you going to upload your image?
upload the .png
I am not sure how that will help
we can test to see if the image is the probelm...
@unique forge This is the tutorial I would generally recommend: https://www.learnpyqt.com/courses/start/creating-your-first-window/
But you want to connect another function to each of the sub-widget enter buttons, and when the user pressures that button, you launch a function to gets the values of the LineEditWidgets
is that only an alpha...
ok great
@oak portal so to do a quick check, could you download this .ico and test it with this? I wonder if the .ico conversion failed. https://icon-icons.com/icon/ghost-halloween-evil-casper/154072
Sure
_tkinter.TclError: bitmap "ghost.ico" not defined
And yes, it is in the same directory
And it is the correct name
main = Tk(className=' Blackjack ')
main.geometry('300x300+50+50')
main_frame = Frame(bg='#303030')
main_frame.pack(expand=1, fill='both')
# icon = PhotoImage(file='ace_of_spades_t.gif')
main.iconbitmap("ghost.ico")
main.mainloop()
This is what I ran
That exact snippet, with that exact .ico file works for me
. _.
Well, this is some unique error to me then?
What python version you're running it on?
Tested it on 3.8.6 and 3.9
Tried it on 3.8.5 and 3.9 and 2.8.7, none work
(trying on 2.8.7 is more or less a joke tho
)
Could you do this one more time at the top of your script? I'm curious about something:
import os
print(os.listdir())
Whole entire return:
['ghost.ico', 'blackjack.py', 'ace_of_spades_t.gif', 'ace_of_spades_t.ico']
Traceback (most recent call last):
File "/home/potato/Documents/Blackjack/blackjack.py", line 26, in <module>
main.iconbitmap("ghost.ico")
File "/usr/lib/python3.9/tkinter/__init__.py", line 2073, in wm_iconbitmap
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "ghost.ico" not defined
I usually just sent the last line
from tkinter import *
import os
print(os.listdir())
main = Tk(className=' Blackjack ')
main.geometry('300x300+50+50')
main_frame = Frame(bg='#303030')
main_frame.pack(expand=1, fill='both')
# icon = PhotoImage(file='ace_of_spades_t.gif')
main.iconbitmap("ghost.ico")
main.mainloop()
This is what I ran
What OS are you on?
Pop OS, Linux
They're testing it with an ico that I am also using to test now
import tkinter as tk
root = tk.Tk()
root.iconphoto(False, tk.PhotoImage(file='ace_of_spades_t.png'))
root.mainloop()
I tested with the image he uploaded and got the not defined error
because it had an alpha
when i removed it i got this
Well...
Wait
Hold up
I just ran what Chris_ sent with the png file in the directory
And it works?!?
Holy Ravioli Under The Bench?
So for the .ico file issue, apparently on some linux distros it needs to be an .xbm file with a path like this: @/icon.xmb
Okay, bug the png file suddenly works?
not suddenly, Chris_ had said they removed the alpha on it
okay well then something changed when you said it didn't work when we suggested it about 30 lines up
yeah...
I wonder if it's the False that was added?
Someone slap me with a fish because my rumbles are scrumbled.
removes False
_tkinter.TclError: wrong # args: should be "wm iconphoto window ?-default? image1 ?image2 ...?"
Well
Someone cut off my legs >:[
It doesn't work because of that missing thatement?
this is why people use pyqt
hard agree on that
iconphoto's first argument is a truth statement
And we we're trying to pass an image into it
:[
the heat death of the universe will occur before tkinter gets reasonable docs and a reasonable implementation
Is this the pain of using default modules
just tk
Well gentlemen, @eager beacon, @static cove. I thank you for your help, and now I'll go take a cold shower while crying at 1 in the morning.
Goodnight
How do I create other files in python that connect in Tkinter
so like 2 files, first have a button and a window and that button will send u to another file with another window
@uncut pawn you need to treat them as an import library and the use a lambda function to call them. I'm not an expert, but this is what I have found to work. Hopefully, someone will correct me if I'm wrong.
im trying to make my cursor move with my voice and i cannot make my program learn the request to action properly
is there any async ui module?
vui with ml
how to set the height of the headings' row in treeview tkinter????????
I'm pretty sure its tied to the row height
doesn't that change the height of all rows??
yes it would
im saying I don't think you could change it independently
but I don't know loads about tkinter and the first couple of links on google led me to believe that it is tied to all of the rows height
sad maan..i really needed to reduce the table width in total to adjust a chart beside it
i mean i need to wrap the heading texts
can any suggest any alternative?
use pyqt
like I said, i dont know enough about tkinter to give much advice.
did you set a breakpoint anywhere?
so no
no haha
Code works fine on VSC debugger
yes
now you can debug
Ah, I should put a red dot next to the lines i want to debug?
Nicee ty
is there any way to add xscroll to only treeview and y scroll to both tree view and the cahrt beside it?????
My Tk window appears without the top bar 
from tkinter import *
main = Tk(className=' Blackjack ')
main.geometry('500x500+50+50')
main_frame = Frame(bg='#303030')
main_frame.pack(expand=1, fill='both')
main.iconphoto(True, PhotoImage(file="ace_of_spades_t.png"))
main.mainloop()
For me, it appears without the top bar
Is there some reason why?
Because it did appear yesterday
Literally void 
Oh, even IDLE appears without it
Because it did appear yesterday
@oak portal sure u dint make any changes?
Nope, but after testing it on another pc, the titlebar appears, so it's a local issue
hello, is it possible to assign an object to a button in tkinter and if yes how?
wdym by assign an object?
variable = object
i have buttons which loads card images ... and i want after playing out the cards to be compared by its class values
i get this error: AttributeError: 'Button' object has no attribute 'colour'
I still don't understand what you want to do but can tell you that Buttons don't have a colour attribute https://effbot.org/tkinterbook/button.htm
yes that is true
i want to create a button and assign a card object with its values from a class and access it afterwards
if it helps i can paste code and picture?
since the buttons are just basic classes, you may be able to add attributes to them
cleaner way would be though to subclass buttons and add an additional arg in __init__
yup
global playerTwoCard1
newcard = stack.pop()
img = Image.open(newcard.bgpath)
img_resize = img.resize((150,300),Image.ANTIALIAS)
newimage = ImageTk.PhotoImage(img_resize)
playerTwoCard1 = MyOwnButton(root,image=newimage,newcard.colour,newcard.value)
playerTwoCard1.image = newimage
playerTwoCard1.grid(row=0,column=1)
class MyOwnButton(tkinter.Button):
def __init__(self,colour,value):
super()._init__(self,colour,value)
self.colour = colour
self.value = value
The Button still needs to get its other arguments, so you'll need to pass those through using
def __init__(self, colour, value, *args, **kwargs):
super().__init__(self, *args, **kwargs)
class MyOwnButton(tkinter.Button):
def __init__(self,colour,value, *args, **kwargs):
super()._init__(self,*args,**kwargs)
self.colour = colour
self.value = value
like this?
i get the error: ImportError: cannot import name 'args' from 'code' (/usr/lib64/python3.8/code.py)
ok thats possibly because the ide added from code import args ... without it there is no error, but i got a different one:
playerTwoCard1 = MyOwnButton(root,image=newimage,newcard.colour,newcard.value)
^
SyntaxError: positional argument follows keyword argument
and
AttributeError: module 'tkinter' has no attribute 'MyOwnButton'
you will need to supply the button with color and value first, or do some ugly keyword manipulation otherwise
and since MyOwnButton is not part of the tkinter namespace, you can't prefix it with tkinter. as well
it is possible that the wrapper class for Button however overrides the __getattr__ method, in which case this will fail
Just checked, they don't
Hi
does anyone know how to store the text of a QLineEdit widget in a variable in QT5
@amber roost ok, i dont understand what i have to do now 🙂
also does anyone know how to print back text in another QLineEdit widget
to store text you just say x = self.lineEdit.text()
ok
I think so
yes
setText
Here is my GUI in one LineEdit widget I input the number. And in the second LineEdit it will print the squared number
can you tell me how to use setText
yes
when I run it just ends the code
---------- FINISHED ----------
exit code: -1073740791 status: 1
@amber roost
do you mean like this
global playerTwoCard1
newcard = stack.pop()
img = Image.open(newcard.bgpath)
img_resize = img.resize((150,300),Image.ANTIALIAS)
newimage = ImageTk.PhotoImage(img_resize)
playerTwoCard1 = MyOwnButton(newcard.colour,newcard.value, root,image=newimage)
playerTwoCard1.image = newimage
playerTwoCard1.grid(row=0,column=1)
and class
class MyOwnButton(tkinter.Button):
def __init__(self,colour,value, *args, **kwargs):
super()._init__(self, colour, value, *args, **kwargs)
self.colour = colour
self.value = value
post the code famous
all of it
everything you've changed since it stopped working
def showsqr(self):
sqr = self.lineEdit.text()
self.lineEdit_2.setText(sqr)
also
self.ui.pushButton_10.clicked.connect(self.showsqr)
what was it?
the missing .ui
ah
@leaden tiger sorry, i was gone there, but yeah, this should work apart from the misspell of __init__/_init__
i still get
AttributeError: module 'tkinter' has no attribute 'MyOwnButton'
also i don't know if that .image thing is going to work out
Then you have tkinter.MyOwnButton somewhere in your code
either that or i forgot how super works
well turns out i did
You don't need self in the __init__ from super()
Can someone explain me what is parent in tkinter
idk where to write "tkinter.MyOwnButton"
idk how to solve the error then 😦
post the full traceback, including the line where the error comes from
@eager beacon can I tell self.ui.lineEdit_2.setText(sqr) that the input is an integer/int I want the input of lineEdit to be squared and then printed in lineEdit_2
@amber roost found the error 🙂 ... just a second ... i try out if the values are given to the function
Traceback (most recent call last):
File "/usr/lib64/python3.8/tkinter/init.py", line 1883, in call
return self.func(*args)
File "/media/linux_d/Python/SchnapsenGUI/Main.py", line 186, in playervscomputer
img = Image.open(newcard.bgpath)
AttributeError: type object 'Image' has no attribute 'open'
No, Famous anything in a lineEdit needs to be a string
oh
just square the number before setting the text
sqrd = sqr * sqr
Oh nvm guys i figured it out
s1 = int(le1.text())
squared = s1*s1
s2 = str(squared)
le2.setText(s2)
yep
just remember that any values you can see on the screen aside from sliders and spinboxes are going to require text values when setting their data
ok
@amber roost i did not have that error msg earlier, something is wrong and i dont know what
@amber roost i found the error ... its the import tkinter in the class file
@amber roost i solved all errors and get this one
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib64/python3.8/tkinter/init.py", line 1883, in call
return self.func(*args)
File "/media/linux_d/Python/SchnapsenGUI/Main.py", line 189, in playervscomputer
playerTwoCard1 = MyOwnButton(newcard.colour,newcard.value,root,image=newimage)
File "/media/linux_d/Python/SchnapsenGUI/Classes.py", line 46, in init
super().init_(colour, value, *args, **kwargs)
AttributeError: 'super' object has no attribute 'init_'
you have misspelled __init__
oh
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib64/python3.8/tkinter/init.py", line 1883, in call
return self.func(*args)
File "/media/linux_d/Python/SchnapsenGUI/Main.py", line 189, in playervscomputer
playerTwoCard1 = MyOwnButton(newcard.colour,newcard.value,root,image=newimage)
File "/media/linux_d/Python/SchnapsenGUI/Classes.py", line 46, in init
super().init(colour, value, *args, **kwargs)
TypeError: init() takes from 1 to 3 positional arguments but 4 were given
you are supplying the original tkinter button with colour and value as well
it needs a parent widget however
isnt "parent" super() ?
no, i'm talking about the parent widget
is
tkinter.Button.init(colour, value, *args, **kwargs)
or
super().init(colour, value, *args, **kwargs)
correct?
because tkinter.Button.init
makes a different error message
either tkinter.Button.__init__(self, ...) or super().__init__(...)
but the Button doesn't need colour or value
just a parent widget
i dont understand what you mean
and the configuration args
class ImageButton(tk.Button):
def __init__(self, parent, color, value, *args, **kwargs):
super().__init__(parent, *args, **kwargs)
self.color = ...
ahhh, ok
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib64/python3.8/tkinter/init.py", line 1883, in call
return self.func(*args)
File "/media/linux_d/Python/SchnapsenGUI/Main.py", line 189, in playervscomputer
playerTwoCard1 = MyOwnButton(newcard.colour,newcard.value,root,image=newimage)
File "/media/linux_d/Python/SchnapsenGUI/Classes.py", line 46, in init
super().init(parent, *args, **kwargs)
File "/usr/lib64/python3.8/tkinter/init.py", line 2645, in init
Widget.init(self, master, 'button', cnf, kw)
File "/usr/lib64/python3.8/tkinter/init.py", line 2561, in init
BaseWidget._setup(self, master, cnf)
File "/usr/lib64/python3.8/tkinter/init.py", line 2530, in _setup
self.tk = master.tk
AttributeError: 'str' object has no attribute 'tk'
yeah and with that __init__ you'll set parent to newcard.colour and color to newcard.value
playerTwoCard1 = MyOwnButton(newcard.value,newcard.colour,root,image=newimage)
this order?
now parent is newcard.value and color is newcard.colour
Is there a way to look at a process's progress? Like if you have a flask app and a script that is a for loop that adds things to a list, can you see what the list looks like through the flask app? While the script is still running?
@amber roost sorry, i dont know which order
should i put colour and value at the end of **kwargs and put the order around?
root, color, value; literally match them up with the order of the constructor arguments
kwargs always have to be at the end
what are you using @digital rose
ttk
tkinter
@eager beacon
it might be a problem with ttk
because normal tkinter works
@eager beacon How do I add a favicon into the corner of my app with QT5
Hey @unique forge!
It looks like you tried to attach file type(s) that we do not allow (.ico). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a.
Feel free to ask in #community-meta if you think this is a mistake.
app.setWindowIcon(QIcon.fromTheme("Fusion",QIcon(':/Path/To/Image.png')))
you can just use the icon if you don't want the fusion theme
@amber roost i added another 2 variables to that MyOwnButton Class, because i need to change background image with foreground image as well
it looks like this now:
class MyOwnButton(tkinter.Button):
def __init__(self,parent,colour,value,fgpath,bgpath,*args,**kwargs):
super().__init__(parent, *args, **kwargs)
self.colour = colour
self.value = value
self.fgpath = fgpath
self.bgpath = bgpath
playerTwoCard1 = MyOwnButton(root,newcard.colour,newcard.value,newcard.fgpath,newcard.bgpath,image=newimage)
yeah, seems good
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib64/python3.8/tkinter/init.py", line 1883, in call
return self.func(*args)
File "/media/linux_d/Python/SchnapsenGUI/Main.py", line 250, in <lambda>
playerOneCard1 = MyOwnButton(root,newcard.colour,newcard.value,newcard.fgpath,newcard.bgpath,image=newimage,command = lambda: player1click(1))
File "/media/linux_d/Python/SchnapsenGUI/Main.py", line 52, in player1click
removeCardsAndCreateStacks()
File "/media/linux_d/Python/SchnapsenGUI/Main.py", line 113, in removeCardsAndCreateStacks
player1Stack = MyOwnButton(root,image=newimage)
TypeError: init() missing 4 required positional arguments: 'colour', 'value', 'fgpath', and 'bgpath'
the cards are all displayed
i did not change the values in a function, sorry for that error msg
yep
perfect
it works
thank you very much for your help!!!
NameError: name 'QIcon' is not defined
@eager beacon I get this when I run
import it
ok
Does anyone know of a module that will render a simple webpage on a Tkinter canvas?
ImportError: cannot import name 'QIcon' @eager beacon
yeah it takes a bit of time to start remembering where everything is imported from
is there a way to create screen overlays using pyqt5? something equivalent to screendc from wxpython
can you post a screenshot of what you're talking about
I can't really describe it with a screenshot
I just want to be able to display an icon in the corner of my screen, over other applications
all of the time?
not necessarily, it should be an indicator that the program is recording audio from a specific audio device (and then the audio file is saved)
well you could use a QWidget and set the windowFlag Qt.FramelessWindowHint and move it with move(x,y) to the bottom corner of your screen then set it to show when you press record and hide when recording stops
Frameless window hint is a window without the minimize/close controls
is it always focused?
you can also set it to always stay on top
it can lose focus when you click into another window but will remain on top
does it consume input events and/or mouse clicks?
because I'd prefer it to be transparent and still let you click on things underneath it
its a QWidget, you can implement an event filter and make it do whatever you like
uhh
hmm
maybe QWidget.setAttribut(Qt.WA_TransparentForMouseEvents)
but I don't know for sure. I've never tried
i think you may need to set the palette to transparent as well and implement a paint event
I can check when I get home
do you reckon it's better to go with wx instead then?
I've never used it before. Personally I'd stick with pyqt but if you know wx has all of the tools you need to build your app and you're familiar with it already then go for it
Are you going to be handling the audio through the app or does this app just detect recording and display the indicator?
I've never used it before. Personally I'd stick with pyqt but if you know wx has all of the tools you need to build your app and you're familiar with it already then go for it
@eager beacon well, I'm not, this is my first project and idk what the options are (only done some quick googling)
Are you going to be handling the audio through the app or does this app just detect recording and display the indicator?
@eager beacon it'll be linked to a keyboard hotkey that starts and stops the recording
Well if it's just the indicator you might as well go with wx if the widget you need is included
I was doing the function for finding Side A, but when I put in the numbers, the code ends
def funca(self):
b1 = float(self.ui.lineEdit_22.text())
c2 = float(self.ui.lineEdit_23.text())
math_a = math.sqrt((c2 * c2) - (b1 * b1))
sida = str(math_a)
self.ui.lineEdit_24.setText(sida)
@eager beacon
whats the value of math_a before you put it in the lineEdit?
math_a?
yes, your variable in the function you're asking about
well, thats when the problem happens
oh
so whats the value of math_a when you put the numbers in
there isn't anything in there that should cause a crash unless one of those lineEdits does not exist in the UI file
is that the only function that runs?
i suppose the the function could be misspelled in the connect method also
there is multiple functions
right, but is that the only one that runs after you've entered the numbers?
yes
I have double checked
they do
here is what calls the function
self.ui.pushButton_21.clicked.connect(self.funca)
and I double checked
it is indeed pushButton_21
okay well i need to see the rest of the code if i'm going to be any help
Ill send the files
Hey @unique forge!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Hey @unique forge!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com