#user-interfaces
1 messages · Page 43 of 1
hm you could start with https://en.wikipedia.org/wiki/OAuth (or just google oauth, there's tons of material)
(I'm not an expert on this at all, I've just made a few API clients before)
Oh okay, thanks a lot for your suggestions!
I'll be sure to see how I can implement something like oauth
How do i get rid of this?
Here is the part of a code i am using
def shoot():
global player, c
bullet = c.create_rectangle(c.coords(player)[0], c.coords(player)[1], c.coords(player)[0] \
+ 10, c.coords(player)[1] + 3, fill='black')
for i in range(75):
c.move(bullet, 10, 0)
c.update()
time.sleep(i * 0.001)
c.delete(bullet)
del bullet
def movep(event):
global playeravatar, playerwalk1, playerwalk2, walking
global shoot
if event.keysym == "Up" and c.coords(player)[1] > 40:
c.move(player, 0, -10)
walking = not walking
if walking:
c.itemconfig(player, image = playerwalk1)
else:
c.itemconfig(player, image = playerwalk2)
elif event.keysym == "Down" and c.coords(player)[1] < 660:
c.move(player, 0, 10)
walking = not walking
if walking:
c.itemconfig(player, image = playerwalk1)
else:
c.itemconfig(player, image = playerwalk2)
elif event.keysym == "Right" and c.coords(player)[1] < 660:
c.itemconfig(player, image = playeravatar)
shoot()```
okay guys, i'm in the need of a gui module in python.
Altho i have a few requirements:
- non web based, can be compiled/executed offline, etc
- modern. By that i mean something which isn't based on old code but implement new modern concepts like object oriented, implement concurrency natively or make it easy to implement
For example, I consider tkinter as really ugly and old, especially when it comes to implement parallelism it's a big mess, and not mentioning how the.pack()are annoying to put after each action, and how illogical the module is when it comes to documentation and architecture in general... - Works cross platform. At least for windows, mac
- Easily convertible to .exe or application file according to the platform
- native to python, and not stuff like Processing which have to be converted to another high level language and disable the user from using installed python libs or disable the user from using python completely and limitating in some ways, like making global variables act weirdly or some shit
Kivy or pyside, i would say
Does anyone use electron here?
I just heard about it I wanna know from experienced people
Just about everyone reading this is using electron (Discord app) 😛 but since it's a JS thing maybe this isn't the right place to ask
@fathom crypt you know about it?
Know as in know it exists, sure, but I haven't programmed with it (or js for that matter)
Ok...? Anyway, this channel is only for Python UI libraries
Maybe you should add this to the channel name
I find this server helpful when i wanna ask something about python but when i ask about something that is not python everyone gets cocky and feels offended for some reason
I mean this server is supposed to create an good environment to learn coding or just to learn python?
it is called Python
Please refer to the channel info: For help relating to Python User Interface libraries (e.g. PyGame, Tkinter, Kivy, Curses)
not coding
If you want to discuss non Python libraries etc. there are 3 offtopic channels.
Its a shame big server like this doesn’t embrace or tolerate other languages
Anyways, anyone using Qt5.14 ? After updating from 5.13 my app crashes on closing, just wondering if that's something related to it or to the version
You’d think it should since theres so many programmers each knows a variety of languages
well, this server is about the python language and community, that's its purpose, that's what interests the people who manage it the most, if you have questions about that, #community-meta is the place for that, not here
but don't expect the server to become about all Programming or all CS
right
how do i access a class from the outside? :S
import GUI #put the QT class inside here
ClassMainWindow = GUI.Ui_MainWindow
when i write this
ClassMainWindow.Brightnessslider
i get this error
AttributeError: type object 'Ui_MainWindow' has no attribute 'Brightnessslider'
i know that Brightnessslider is inside the class and under the function
def retranslateUi(self, MainWindow):
but i dunno how to call it to get to the brightnessslider
It's likely an instance attribute so you'd need an instance of the class.
i've never worked with classes how?
Then I suggest you find a resource on classes before you jump into this.
Here are some
i have a Qtslider that goes from 0 to 255, how can i convert that range from 0 - 255 to 0-100 and display it on my QTlabel?
If I wanted a good, async gui, what module would you reccomend?
i haven't tried async with it yet, but kivy does support asyncio/trio now.
the dev version though, not latest release
How do I force an update on a TKINTER frame. I am udating data in one frame (frame_a), but when I change frames to display the data (frame_b), the new data is not there. I have tried frame_b.update() but it is not reinizializing the frame. ```
PYTHON
Controller Function
def refresh_frame(self, page_name):
frame = self.frames[page_name]
frame.update()
Frame_A Call
def update_pages(self):
self.controller.refresh_frame("UserManagementPage")
self.controller.refresh_frame("VMManagementPage")
I've made a small app with kivy & asyncio, easy and no problems at all (tested on Linux+Android)
Hey Im using pyqt5 and using grid layout, but when I put a label on the grid layout it automatically puts it in the middle of the window!? How could I use girdlayout and that the first label is top left, second is bottom right, etc
Ok sorry for the horrible picture, but here is what I kind of want
When I click a rectangle, how do I add a glowing border to a rectangle?
@frank lily which library?
Pygame @alpine blaze
ouch, i don't want to remember, good luck
@fathom canopy i know its been a while but it is becuase your calling shoot() again which breaks it out of for i in range(75): starting it over? As for whey they all continue again later is it becuase as soon as the loop finishes it goes back to what it was doing which is the previous bullet?
all a guess
but my best guess :P
Anyone know how to have elements resize to the relative window size in PyQT5 Designer?
I want to have complete control over element locations, but have them shrink or grow depending on the window size.
@vast tiger I don't know exactly about PyQt5 designer, but I have had the same problem as you. I was using grid layouts but things were not appearing exactly where I want them to appear
From hours of reading, I learned that you can create your own layouts, you can customize a LOT of things using code, so I completely ditched qt designer.
Guys I have this, (2 labels in a group with grid layout)
How can I make them touch eachother ?
@jagged halo yeah and how not to break the cycle?
no clue, make a new thread for each bullet? probably not the best idea lol
oh i can move a list of bullets
smart
peekaboo
I was thinking about UI files for qt to replace my longer inits and setup methods but haven't looked at them before because it didn't appeal much.
Is there something like a reference for how to use them with PyQt? Mainly if I should attempt to write them myself (and resources for that if yes) or just attempt to use the designer where possible.
And things like if there is some inheritance of basic layouts
I think QML was intended for that
When I tried QML it was Just QtQuick and things like that instead of normal QtWidgets and didn't support them iirc
How can I still enable grid window in the PyQT5 Designer so the elements move relative to the window size but they don't snap to a position?
Anyone a tkinter user?
Do you need help ?@viscid ginkgo
Do any GUI libraries use html?
html? for the controls? No. but qt uses css
You can also use electron and flask if you want to use python
Can any display html? Many
If going with python because the .ui seems more complicated than I'd want for manual work, would you separate the UI bases from logic with files (popups and popups_gui as an example) and inheriting the bases or just keep the methods separate
Yes, I would try to keep it separate
Maybe subclassing isn't the best way. There are various design patterns out there that you could look into and try to apply to Qt, if possible.
@dawn glacier Yeah, I need a way to refresh a frame in the stack. I found a work around by reloading the data.
I have this class as an example, I also have a Hub class that connects workers with various windows. https://paste.fuelrats.com/urexocixos.py
I can see how things like the populate_combo and load_journal methods could be moved there, but for the worker_signal which can't be moved outside of that class, how should it be handled? Connect it to an another signal in the Hub? Also feels like the Hub class could get too big if I move it all out from there becuase I have some (now messy) ui classes which have 4-5 methods for adding and handling their data
I'm moving to python from html/js. Which GUI library would you recommend?
depends on what you want, pyqt/pyside are common for desktop applications, kivy is also a possibility, with the benefit of multitouch interactions, and availability on android/ios, and with a more pythonic api, but looks less native on desktop.
thanks
@eager vigil If you still wan to develop online, flask is a good way to go.
i need help with pyqt
hello, anyone here?
I just started learning GUI and I had this problem with importing the image!
can anyone help?
icons probably aren't a valid format for normal images
weird that the first one (logo1.ico) worked, the 2nd didn't!
the first one is for loading an icon specifically
so it's okay with importing a .jpg or .png in the 2nd?
try making a png or something, ico is a more complex format that can contain multiple images
alright, just a sec
Not sure if png is supported as pillow usually handles those
but a better bet than ico
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 939, resource id: 12146163, major code: 40 (TranslateCoords), minor code: 0
Using pyqt5
Oh is this because i run as root?
How can i change that
Hello guys, how can i update the tab after i set its object name?
Got some code?
Hey everyone, i wanted to manage my Text editor with a Box Layout (So far its with a centralwidget) but i cannot seem to show the items after i add them into the layout
The main interface is built here - https://github.com/F4zii/shwift/blob/master/shwift/interface.py
Guys I need help... Can't find this online !
I have this, (labels with grid layout in a group)
I want to make it so when I hover over it, it does the exact same thing as a default list in qt designer
So like when I hover over it, it makes an animation or does this
Why not use a QTableWidget?
I think trying to implement what you're asking yourself would be a bit involved
Alright so I kinda did it, really complicated but now I need to do second part,
def eventFilter(self, object, event):
clicked = True
rowNum = object.objectName()[-1]
connectedObj = self.dictLabelObj["Connected" + rowNum]
onlineObj = self.dictLabelObj["Online" + rowNum]
roomObj = self.dictLabelObj["Room" + rowNum]
privateObj = self.dictLabelObj["Private" + rowNum]
if event.type() == QtCore.QEvent.MouseButtonPress:
if event.button() == QtCore.Qt.LeftButton:
privateObj.setStyleSheet(self.clickSt)
roomObj.setStyleSheet(self.clickSt)
connectedObj.setStyleSheet(self.clickSt)
onlineObj.setStyleSheet(self.clickSt)
clicked = True
pass
elif event.button() == QtCore.Qt.RightButton:
pass
if event.type() == QEvent.Enter:
privateObj.setStyleSheet(self.hoverSt)
roomObj.setStyleSheet(self.hoverSt)
connectedObj.setStyleSheet(self.hoverSt)
onlineObj.setStyleSheet(self.hoverSt)
#object.setStyleSheet(self.clickSt)
pass
elif event.type() == QEvent.Leave:
if clicked:
pass
else:
privateObj.setStyleSheet("")
roomObj.setStyleSheet("")
connectedObj.setStyleSheet("")
onlineObj.setStyleSheet("")
# self.stop = False
return False
its kinda complicated, uh, is there a way to LOCK, like disable all changes to a label? Because when i click on it I want it to stay another color... But when i hover over another label the color of the clicked label changes back to white
is anyone here able to help me in #help-croissant?
since my pyqt code aint working properly for some reason and I have no idea why
Its probably some stupid typo or something
nvm I got it to work
I'm using PySide2, and I have a for loop where I initalize buttons.
I attach callbacks to the buttons, but how do I figure out which button was clicked inside the callback?
this seems way too hard, even though it should be simple
buttons should pass their objects on some events
Not sure if it's on the all that that fire when you click, but you can set an objectname or keep a dict/other container of them
Using QDesigner.... Anyone know a good way I can achieve this?
That look sort of look?
I'm trying to get the label section under the Header section, so that you can see the border radius on the label section
Not sure about QDesigner, or the proper way to do it with Qt without searching for it... but 2 rects come to mind
If I stack the two widgets ontop of each other. The sharp bottom can be seen.. I want it under the header section so it flows nicely.
Is it possible to overlay widgets?
Not finding anything via google searching :/
Don't really know how I'd do it and don't want to lead you the wrong way
Hmmmm.... Wonder if I can just use a Tab widget and change the border-radius for the tab and page.
In kivy, I have got a Boxlayout with 2 further BoxLayouts inside
| BoxLayout | BoxLayout |
|-----------------------|
| BoxLayout | BoxLayout |
Would like to make the bottom one smaller than the top but can't figure out how to do it (using kv lang)
Was thinking something like this on the lower BoxLayout: yml <LowerSplit>: size: (Window.width, Window.height * .25)But it doesn't work at all, size does not seem to affect it
@rocky dragon no, they don't seem to pass their objects
and how would I do this with a dictionary?
there's also sender of QObjects that'll get you the thing that called the slot it's in if they don't pass themselves
I don't think I understand what you mean...
!d PySide2.QtCore.PySide2.QtCore.QObject.sender
PySide2.QtCore.QObject.sender()```
Return type [`QObject`](#PySide2.QtCore.QObject "PySide2.QtCore.QObject")
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns `None` . The pointer is valid only during the execution of the slot that calls this function from this object’s thread context.
The pointer returned by this function becomes invalid if the sender is destroyed, or if the slot is disconnected from the sender’s signal.
Warning
This function violates the object-oriented principle of modularity. However, getting access to the sender might be useful when many signals are connected to a single slot.
Warning
As mentioned above, the return value of this function is not valid when the slot is called via a `DirectConnection` from a thread different from this object’s thread. Do not use this function in this type of scenario.
See also... [read more](https://doc.qt.io/qtforpython/PySide2/QtCore/QObject.html#PySide2.QtCore.PySide2.QtCore.QObject.sender)
How do I use that function?
There don't seem to be any examples
Where should I call it?
in the slot that received your signal
it doesn't seem to work...
Don't call it directly
I assume you have a QMainWindow or something where the button is, so call self.sender() or something like that
ah
Anyone used .qm files with QTranslator? Wondering how the same words should be handled around different contexts
In kivy, I have got a Boxlayout with 2 further BoxLayouts inside| BoxLayout | BoxLayout | |-----------------------| | BoxLayout | BoxLayout |Would like to make the bottom one smaller than the top but can't figure out how to do it (using kv lang)
Was thinking something like this on the lower BoxLayout: yml <LowerSplit>: size: (Window.width, Window.height * .25)But it doesn't work at all, size does not seem to affect it
hello, I was trying to create a menu bar, no errors found but it did not work
can anyone help?
So uhhh can make a label "Double Clickable"?
@digital rose which framework/library?
Anyone have a good resource to learn PyQt?
@digital rose check out pyside2 - it's just like pyqt, but from qt
and I think it has better licensing
Okay thanks @past pivot !
Np
Is tkinter widely used in the industry? Anyway i’m learning tkinter right now is it similiar to Pyside2?
I don't think so, it has outdated code and has elements looking like from Windows 98 alone, i'm not sure really. But I would say no if it was a serious application, however it is fairly easy to learn without mentioning illogical programming.
Alright gonna learn pyside2 then! Anyway can Kivy support iOS pretty well? I want to build like a productivity app for myself, and i heard that Kivy supports crossplatform what kind of quality i can expect from it?
kivy does support iOS as well @digital rose
kivy has the particularity that it uses its own widgets, so your app will look about the same on windows, osx, android, linux, ios, some people like that, some don't, i find this very freeing and desirable if you are ready to give a particular design to your app, as kivy allows for easy customization of your widgets (and even creating thom from scratch, it's really easy), you can really go where you want in matter of design. For this reason, quality depends a lot on you, the default look being quite modest.
I will use kivy in my personal project then xD i don’t want to learn react native or swift atm so i think i’m just going to try them all, thx for the help guys!
🙂
you do need a mac with osx and xcode to test on an iphone btw, it's now free to test on emulator and your own device i think, but to publish on store to share with anybody, you need to pay the apple tax, i think some $100 a year.
god i hate iphone so much, the only reason i’m using iPhone is because it was a gift from my mother 😭
@digital rose which framework/library?
@alpine blaze
It was pyqt5 but uh I figured it out, just made another class and modified and modified a bit the original btn class
With signals, but yeah if you know another, better, way to do it tell me 
so I've been reading through a bit of the kivy docs and im not quite sure wether im just missing out on something but is there a go to way to spread your widget definitions accross multiple files?
with widget definitions meaning both the kv files but also the logic implementations in python
anyone?
you can use the Builder class to load files/strings of kv definition
@odd hamlet yes. here's an example from the code jam: https://github.com/python-discord/code-jam-6/tree/master/inquisitive-investigators/rex_explorer
the Factory class can also be used to register widgets in modules without loading them before, so they are loaded as needed.
but it's true that while the tools are here, the manual for how to use them is not really present.
good so i didnt miss out on anything^^
@timber prism i'd recommend either kivy or pyqt
So these help you rapidly develop GUIs with python.
What about the rest of the application. Common functions that many apps need?
could you elaborate on common functions?
what common functions are you looking for?
Its a broad question. But you can think of features that many apps use. For example dialog boxes, importing CSV files, saving preferences, supporting fonts.
Then if your talking about types of apps you could think of all the features that every app of a certain kind always has.
Screen Scraping
Printing to PDF
Conditional Font manipulation (colors, size, style)
ETC
many of the GUI features itself are ready for you to use in kivy & pyqt including dialog boxes, different fonts, and many different wigets. dealing with csv files, you can use the csv module. for printing to pdf, pyqt has a way to do that
Ok thanks, its good to know there is something out there for the GUI part.
Now I need to look for the app features part.
there's plenty of libraries out there; i'm sure there's one out there for your needs
Thanks for your help
no problem!
Kivy has plyer to put commonly needed mobile feature together
And the underlying libraries, pyjnius and pyobjus, allow calling java and objective c code on android and ios, to use other system functions.
🤔
@alpine blaze what is the benefits of using pil as the text renderer? sdl2 does work on my system, while pil needs pillow installed I think.
it's an alternative, i rarely use it, i don't think there is any particular advantage, i think we had it before the switch to sdl2, and there is no particular downsides to it.
pillow is also an alternative image loader, that can load a couple things that our sdl2 provider can't, like gif, so it can be worth having for that.
that is interesting, thanks.. ill keep that in mind if i need to use gifs
yeah, it's been there since basically the dawn of times, in kivy history.
if you need animated things and have a choice, we support a weird thing that works well for us, just put pngs in a zip, and use that as source, functionally identical to gif, but with real transparency, and usually smaller in size.
im writing a JSON editor with a graphical interface for a new game I just got into
png and drag and drop options is what i need atm.
🙂
we have a DragBehavior now, i didn't use it because i had made custom things for my stuff before we had that, but it's worth looking at
how nice 😄
i want to stack dragable elements on top of each other, ill be sure to look into it 😄
thanks
We found using a .zip more performant than a .gif
What text entry should I use for chat server?
Depends really, do you want single line or an entry that supports mutiline?
i recommend kivy 😄
but it depends on what you want, it's more fit for some things than for others
and for others, pyqt/pyside2 is certainly a better option.
pyqt and pyside2 are the same thing?
they wrap the same c++ framework
in some cases they are interchangeable, pyside2 is the official one but when I tested it I had some problems (that could be only relevant in the scope of my app)
qt also offers a lot more than ui so it's a bit more heavy to download
Hello guys
I am new here
Is there any module to use other than tkinter(simpler) for making gui
both of the mentioned above apply here
qt has a more similiar look and utility as tkinter, and kivy gets you more freedom in building it how you want it but doesn't have premade stuff for desktop etc.
@digital rose Sorry, I wasn't here
But this is a better channel to ask about Qt
Anyway, I'm not convinced you quite have pyqt5 installed (or pyside2) - you may have installed it to your system python, but if you're using a tool like pycharm then you may also have a virtualenv it needs to be installed to
Ah, I see
so, are you using a tool like that?
I have JetBrains dotPeek 2018.3.4 installed so maybe it's causing a conflict?
Win10 and I used cmd.exe and installed via pip install PyQt5
So if you did python in a terminal, can you import it?
I followed these instructions essentially: https://poorlydocumented.com/2019/11/installing-corentinjs-real-time-voice-cloning-project-on-windows-10-from-scratch/
That doesn't mention PyQt at all
just open a cmd, python
then do import PyQt5
see what happens
It's in the requirements text
umap-learn
visdom
webrtcvad
librosa>=0.5.1
matplotlib>=2.0.2
numpy>=1.14.0
scipy>=1.0.0
tqdm
sounddevice
Unidecode
inflect
PyQt5
multiprocess
numba
So when I do pip install -r requirements.txt it should have installed it anyways
alright I will try that
Ok, but still do that
Yep, it's installed then
Sounds like an issue with the software you're trying to run
Back to the drawing board. Thanks very much 🙏 It might be to do with nvidia from what I understand.
I'll do a thorough uninstallation and see how I get on
Thanks anyways 👍
Does anyone know how to style PyQt5 to become more pretty? I use Qt designer to design my UI then convert it to .py with pyuic5, do you have to code or you can use some interface tool to style it?
and while learning i saw some CSS, does this mean PyQt5 uses CSS for it’s stylesheet?
It uses QSS which is similar to CSS https://doc.qt.io/qt-5/stylesheet.html
You can write your own or find a style you like online
Thx! i have been looking for this
I am currently trying to build a linux desktop environment on top of i3wm. To navigate through things like settings and applications, I plan on using something similar to dmenu. Could someone point me towards how to make such an application?
demenu is pretty simple, you just need to draw a borderless window and to take keyboard inputs, filtering through a list of options.
basically any UI framework will allow you to do that
you might want to have a look at rofi though, it's a bit more advanced and also has the possibility to add providers and to display icons and such
switched from dmenu to it a year ago i think.
I have a tkinter code that displays an image of a custom made title with a blue background. then i want to display 3 modules. one entry, one button and one label. the play is to make it look like this:
how would i do so?
at the moment i've got this: using pack()
ok 1 sec
first time using tkinter
a lot of trial and error tho
yeah i realise now xD
also look. i use the white rectangle in PS to match with the top left corner so i know the EXACT pixels i need to go across and down
im not that intelligent i guess
thats just cool thing i realised
cause i made the title myself in photoshop and still had it open
you like?
thats cool
hopefully its a good grade for my coursework xD
we got told to make ANYTHING
and its 20% of our final grade
we then need to write like alot of analysis on our code and process
a fruit machine game was the first "proper" program i made when i was like 15, but that was just text. so while loops and if statements. adding an interface and other stuff should be good enough to show i 'know what im doing'
xD
thank you 🙂
Hello everyone. o/
I really glad to become a part of this great community. I hope i'm not going to bore you with my newbie questions. :)
As a newbie coder i'm looking a way to store my images. Right now i encode it to strings and store it in .py as dictionary, then i call from main file.
Is there any way to do that more efficient?
I already tried json, but have no luck to use it in tkinter. Maybe something else what i should read?
EDIT: Also, English is not my native language. So, sorry me, guys for any grammar mistakes.
I'm not entirely sure what you are trying to make with Python. But there are libraries meant to work with images in an effcient way. Are you trying to display the images in a GUI program, like a picture viewer? Or are you trying to edit the images in some way?
I mean GUI elements, like buttons, windows, background. Or something else only for interface.
I don't follow what you are trying to do. I don't really know GUI programming or Tkinter so it's hard for me to say. Maybe posting some of your code, or some of the json can help other people help you
What's wrong with storing them as regular image files?
Its almost 50 files. :)
Would be good if i can store it without ability to inspect.
What do you mean "without ability to inspect"?
look, copy/paste, use it without permission.
I can't help you with that. I'm not familiar with how to accomplish that, but my understanding is it's not really easy to prevent that with Python.
If someone tries hard enough and puts enough time in, they'll be able to get those images
Yep. Python seems fairly easy to 'get into' with the REPL and all those other fun features
Anyway, since you dislike many files I get the sense that you want your application to be in a single file? If that's the case then you should look into packing it into a binary/executable (e.g. .exe file on Windows) rather than jamming everything into one .py file.
Hm, sounds good. Its possible to pack all .py files in 1 exe?
I have 3. Main, system, image data.
You're welcome
Hey guys! What library would you recommend for a simple card game if I have no experience with gui at all?
if you are comfortable enough with OOP, i'd recommend kivy, (but i'm biased, as one of the devs)
Thanks for the quick response. Is it easier to get started than tkinter?
the gallery apps are beautiful
thanks :), i don't think tkinter is specialy easy to get started with, it has a lot of weirdness imho, and the doc is pretty spread out.
kivy is not perfect either, but i do believe it's easier to use than tkinter.
it's been a long time i didn't do any tkinter, but i don't think it changed much.
great! Where do you recommend to get started with kivy?
Nice, thanks! I will give it a shot 🙂
🙂
are there any other GUI libraries in the standard library aside from tkinter?
you can hook into native ui with ctypes :p
why does it need to be in the standard library?
Is there is a way to get the coords of an image with pyautogui regardless of it's rotation? locateCenterOnScreen needs to find the exact image to work.
Anyone knows if i can use .cur encoded with base64 in tkinter?
Hm. Still have no luck with pyinstaller.
In tkinter Label config i have ````cursor="@cursor-exit.cur"and for root i also useroot.iconbitmap("icon.ico")```
Then i pack all my scripts with pyinstaller with commands:
• --add-data "icon.ico;icon.ico"
and
• --add-data "cursor-exit.cur;cursor-exit.cur".
And anyway .ico and .cur still should be in one folder with .exe. Or i will get message Fatal error detected
Anyone could help me with that?
I'm about to head off but I just saw this and I suggest you clarify what the problem is. You've stated what you've tried but not what is wrong.
Is it the penultimate line? That despite including them with --add-data, if the files are not present beside the exe, you will get a fatal error?
Oh, really sorry. I will try to clarify.
I'm trying to pack all files to one .exe. I have files beside python scripts:
icon.ico and cursor-exit.cur. if i even pack it with --add-data i can't launch my .exe without this files. That's the problem.
i think the flag is --onefile now i have not used pyinstaller in awhile so i may be wrong but thats the flag i used to use
Forget to say, i already using this flag. But nothing.
onedir is usually advised first to see if that loads before onefile'ing
Hi guys i need help
i want to change the Top bar of the Windows to set Tittle in the middle and change Minimize MAximize and close button
so i make a framelesshint window and i create another bar
and inside i create buttons + set tittle *
but i don't know which is the best class to do that ToolBar / MenuBar / StatusBAR
i'm working on PyQT5
thanks
I need help to select my first library for user interface, i think Kivy is the best for her compatibility
I have an assignment which is to simulate a lift algorithm and optimise it to be time efficient for different numbers of people requesting the lift at various floors. I was wondering which Python library would be most recommended for this assignment.
It would be a desktop application, and I've done a bit of research beforehand; it seems like PyGame might be a good option, but I was also wondering about PyQt5?
I have some experience with PyQt5 so it would be quite easy for me to get into, but would it be appropriate?
I don't think it needs to be animated, but I've heard PyQt5 can have animations as well (although it seems harder than PyGame)
I was thinking I could simulate it with blocks representing floors, and the lift being a coloured block, with the floor changing colour when the lift is on that floor
Id pick the simplest solution tbh, it seems simple enough and its representation doesnt really need to fancy unless you get marked down for it.
So do you think PyQt5 would be the simplest solution in my case? I already know how to design the interface through Qt Creator and get it linked up, I'm just wondering if it would have any limitations for my use case here
If you are most comfortable and have experience then yes.
So I started my basic interface
And I wanted to have blocks on the right side of the grid to represent the floors, then I'd change the colours of them when the lift is on that floor
But I'm not sure how to create the blocks
Would I just change the colour of the coordinates of the grid in the driver code?
Anyone knows how to make a GUI with a transparent hole in the middle? one that you can see other apps through?
doesn't matter tkinter or pyqt5 or other (in windows)
like this
can i get pyqt5 for python 2.7?
can anyone help make some form of circle that i can change colour? only im only using QtCreator so cant find anywhere to make custom widgets etc so really need someone to walk through it with me if possible? i did find a premade example, the idea is a LED like icon to indicate the server status
the link for the widget i want to use is:
https://store.kde.org/p/1132197/ however i dont know how to use it, im using QtCreator and only editing a single form.ui file which non of the guides do
Kivy is not working for the 3.8?
How do I add interface input/button on turtle or tkinker
@digital rose you need the pre release for 3.8 or use latest with 3.7
@tawny terrace kivy supports using a mask image to give your window an arbitrary shape, that would work for your case
Hello, I am creating a project using tkinter and I want to do this. I've written code but it is not working out
https://paste.pythondiscord.com/uqucujifur.py
my code is here
How do I make two frames in one window and have an image in next frame
@upper knoll Try making two different scripts, one for each frame, then have buttons that will run one script from another, making it seem like they're the same program
I don't get it, could be elaborate more please
I've just started learning it and don't know much about it
Yo, do you recommend kivy or tkinter?
I don't know kivy, but I sure as heck don't recommend tkinter
Was looking to make first project with a bit of GUI, pysimplegui looks fairly simple and good, is it a reasonable package to use ?
It's a very basic program, just want some menus, submenus, press a button program does the thing, go back to base screen, etc.
Hi people, I want to make a very small software for myself to take screenshots, is PySimpleGUI a good place to start for the UI? I want something dead simple.
Is simplegui the thing programmed by some guy from the Rice University ?
If it's this i played a bit with it during their online Course, it was okay to make simple games
Not sure how it lives outside of this
How it seems it's own thing despite names being really similar. Disregard my comment
with tkinter, I'm trying to create a label inside a frame built inside of a class.. the window returns the children, but they're not labeled so I'm not sure how to access the right widgets..
ie, when I look at my_window it gives me: my_window['children'] and it shows me labels like !toplevel.!frame4 is there a way to name the widgets so I can tell which child I'm working with?
can anyone help me with a streamlit related issue ?
(https://github.com/streamlit/streamlit)
What would be the best bet for making a modern style GUI?
qt5 or kivy, kivy will be more ready to use with a flat modern design but needs more work for a normal desktop app if you're also aiming for that
qt is a bit harder to customize
Are any of them easy to use?
both are fairly easy with their own quirks if you have a fair understanding of OOP
isnt kivy mainly for cross-platform?
it's one of its aspects, qt can also do that but isn't as suited to mobile afaik
but for desktop both are fine (depending on the app)
also, if I were to code in kivy, would there be much recoding to do if I were to port it to mac from windows for example?
shouldn't have any unless you yourself use feature specific to that os
Hi there. I'm looking to create a text based MUD-like rpg. I've been fooling around with curses* but I'm not sure it's the best terminal module to use. Anyone have any suggestions or would I be better off trying to do something from scratch?
anyone here using QtCreator?
hello friends, which python ui library/framework works and looks best for mac (if there is one)?
Hey snake lovers!
I've got a question. Been tasked with making a desktop app: digital controller for stage lights (midi signal). Can anyone recommend a UI framework for that kind of task? I've found PyQt and Kiwy appealing but would like to have a more experienced opinion.
both are great choices, but i'd personally go for kivy
Anyone have any help for the question I posed yesterday? ;_;
Is there a UI Maker that could simplify the work it takes? I only recently started with Python and would like to make standalone Executables with Intricate UIs.
Yes, Qt has one.
You still have to write code to connect the pieces but at least you can design the ui with it.
hi all
im looking for advice on the matter of creating a gnome extension
ive heard pyhton is a good way to do this
but some features i want to incorporate are swipe gestures and an array of button, instead of just one indicator
is that possible at all? im trying to do this bcs of my touchscreen device
I did say I have experience with gtk, but that kind of stuff is way different from anything I've done. Heck, I didn't even know gnome extensions used Gtk to create their icons
yeah i reckon my plan might be too much. but im not sure. the way python is presented by others, is that virtually anything can be made
Thank you @young timber and @rugged minnow... I have heard of Kivy but will also have a look at PySide2
Im having some problems installing kivy 1.11.1
What dependecies should i have installed before installing kivy?
Seems like im missing some
is it complaining about something in the logs?
Yeah, hold on
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.
not sure, does 1.11.1 support 3.8?
only used kivy in the recent codejam so don't remeber which version it was that had the version jump
Anyone who knows Tkinter can help me?
I'm trying to get it so when they have entered the IP range and they click the "click to scan" button it runs the code gets the information stored inside the ip variable and prints it out where it says scan_result = scan(ip)
at the moment it just prints out the print stuff i made without any Ips because i want it to get the IP the user gave in the input box and use it
I have a feeling im close to getting it right but maybe i need to rearrange my code or add something
Im new to python and tkinter so if anyone would give me a hand that would be great
kivy 1.11.1 doesn't support 3.8 (at least, that's the tl&dr version), either use 3.7 or use the kivy pre release packages.
im using Qt anyone able to guide me through adding a cutom widget or making one? so far i only have a single form.ui file which i convert with pyuic5 then my program handles the ui from there
@dawn glacier yes
or pip install --pre --extra-index-url https://kivy.org/downloads/simple kivy
Ok, ill try
@alpine blaze It worked, but when im running my app it says xsel - FileNotFoundError: [Errno 2] No such file or directory: 'xsel'
Full traceback here https://paste.pythondiscord.com/isopuyapuy.py
Looks like it relies on xclip or xsel for some clipboard functionality, and you don't have either of them installed (or not on your PATH)
If you install one of them it'll probably fix the error
I got a strange bug on tkinter. I am working on a text editor, and I want to remove the text field when there are no file tabs open
I want to first prompt the user if he/she wants to save the file before destroying it completely
Regardless of the results, the app will then wipe out the text field with .delete("1.0", tk.END)
and then text_field.pack_forget()
The problem here is that the .delete part never comes through
The text_field disappears, but the text itself is still there
It only works when I comment out the save_file() functionn
Is it because of the filedialog.asksaveasfile() function?
What it looks like, after pack_forget():
Any help or ideas will be greatly appreciated.
@dawn glacier yes, xsel and xclip are optional dependencies for clipboard handling.
That sounds like an external os tool dependency
apt if you are on a debian derivative, yum if it's an rpm based distro, etc
Alright
How can i make a button or a label you can hover on and click in kivy?
I am trying to make a layout when every row is a hoverable and clickabe item with some data on it
Like
recycleview as a starting point maybe, hover is watching something like the cursor coords
Hmm
well, making a button is not a problem, i assume, making a list of them can be achieve in a number of ways, and recycleview is a very good one if you have a lot of them and want to be data driven (and if the layout options fits your usage, as it seems to be the case there).
so is your question about handling hovering events? or about using something like the recycleview for it?
How can I make it so when a button is clicked, a new "window" is opened? Like for example how when you login somewhere youre taken to another display. For example, you login and then the display switches to gamemode options. Sorry if Its nit explained great
@dawn glacier https://gist.github.com/126e1481d3d588f14c617a7fcbc38b5d
(though there is one problem remaining, as it pos doesn't actually change when the scrolling happen, as it's relative, so one would need to bind to scroll_y of the recycleview as well, but passing that information around is not really convenient, so i stopped, there not knowing if that was a problem for you or not)
yw 🙂
rgba: C('222222BB') if self.hovered else C('00000000') this is really cool, didn't know about this attr
Or on this button at all
I probably missed some docs
i created the attribute for this class, it's not something that exists in kivy
but as you see, it's not really hard to implement
just add or remove things from the data dict
Cool
i kept things simple there and managed the state directly in the widget, but in more complex recycleview usecases, you want to save the modified things into the data dict and let the dispatched state update the graphical things
Alright, thanks again
Sooo can somebody help me?
what do you need help with?
How can I make it so when a button is clicked, a new "window" is opened? Like for example how when you login somewhere youre taken to another display. For example, you login and then the display switches to gamemode options. Sorry if Its nit explained great
Sorry, don't have great knowledge, and only did something like that for a very short while.
if you're using kivy, take a look at kivy.uix.screenmanager.ScreenManager
I am using tkinter
oh sorry, i have no idea then
this seems like what you're looking for https://pythonprogramming.net/change-show-new-frame-tkinter/
Python Programming tutorials from beginner to advanced on a massive variety of topics. All video and text tutorials are free.
Thank you do much
Thank you do much
- @olive slate
So*
@digital rose if you're starting the app from the command line it should just print there. If you are bundling with something like cx_freeze then it's something you turn on and off in the options for the bundler
You can redirect the print output to your text widget
Does anyone know if I can make like a save button that saves an output to a text file using PyQt5 ?
Yes, you'll just need to link the button to a function that does that
so, I know this is a dumb question, but I'm not sure what I should google search to get more information about it. This is my first time making a UI for a desktop application, and I'm not sure which functions of my app would belong under the different File, Edit, and View menus in the top bar, and I was wondering if there was some kind of best practices document anyone could recommend?
hey any idea about which optimizer is used in image classification model compilation?
using keras?
@clear kernel well, usually file contains operations that are relative to the file/document as a global thing, so load/save of course, but also whatever touches its metadata, and edit would be more about what modifies content in the document, view is for whatever changes how you view and interact with the document. Of course, if your program is not an editor of any sort, the first two ones are probably totally irrelevant, and the 3rd one might be as well.
@lunar kernel i don't think that's the proper place for that.
PyQt5 opens empty window after adding widget
Hey @gaunt portal!
It looks like you tried to attach file type(s) that we do not allow (.flv). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .md.
Feel free to ask in #community-meta if you think this is a mistake.
Hey @gaunt portal!
It looks like you tried to attach file type(s) that we do not allow (.flv). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .md.
Feel free to ask in #community-meta if you think this is a mistake.
that white window at the beginning may be a widget you added
For the one that may wonder, I managed to solve this by creating a QMainWindow using QT Designer and adding the Book class to that, instead of creating the window programatically
Is there some sort of panel object in PyQt5?
I want to just have some sort of blocks which I can change the colour of
I would be putting it inside a grid as part of a lift simulation
Also, how would I dynamically create these objects so that it changes depending on how many floors the user chooses to simulate?
Like, if there are 12, to create 12 floors etc
hi anyone online?
How can you customize the scroll bar of a QScrollArea in PyQt5?
This doesn't help, cause it's for QScrollArea, not QScrollBar. https://doc.qt.io/qtforpython/overviews/stylesheet-examples.html?highlight=stylesheet#customizing-qscrollbar
What do you mean? It's clearly customising the bar not the area
@sudden coral Nope.
It's the opposite.
It's customizing the area, not the bar.
The bar is left untouched.
I can't reproduce
May I misunderstood you
I successfully customised the scroll bars
I just followed the examples in the docs
@sudden coral Sorry my bad.
I've also tried using the same code from there but only worked in Qt designer.
Can you show me your code? Or did you use the designer?
Absolutely
I did not use the designer
I probably could, but it just seemed slower for testing purposes
@sudden coral Are you there?
yes
What is the best user interface library?
depends on what you want from it
I know there probably isn't but is there any async ones?
Most come from other languages with an internal event loop
Think you can do some more native like integration with kivy but no idea there
You think in the future asyncio packages will be more popular?
in general, probably; for GUI can't say because it's pretty hard work and like I said coming from other languages it's using its async or their own event loop
you can still hook into that but it'll be harder than just creating objects and getting nice coros directly
Hey @wide stump!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
@sudden coral Why is the scroll bar not customized? What's wrong? https://paste.pythondiscord.com/cirijitixe.py
Your style only affects the horizontal scroll bar, not the vertical
Question about the Canvas element in tkinter, Python 3.8.0.
Problem: canvas.itemcget(ID, "fill") returns an empty string.
The ID is an ID of a square in a grid, which has been clicked on by a mouse.
I also checked the ID and it is indeed correct accordingly to the mouse position.
The squares from the canvas do not get deleted in any way.
Case closed, I found a solution that works.
hi anyone online?
If you need help just ask your question directly
Does anyone know how I can copy and paste the link of a canva profile picture I made? I want to add it to my embed bot
anyone else getting problems with tkinter widgets strobing when switching interfaces? Like, I'll have a menu interface, then I'll navigate to a login interface by destroying every widget on screen and then creating the login interface, but the buttons on that interface blink white for a split second which is really annoying
can I ask here questions?
Thanks. I'm using tkinter. I tried to do it in many ways, but the there are always so many problems. I'm creating a simple text editor for a language I created. The basic things that I want to include in the root windows are:
- The width of the root window is the width of the screen and the height of the root window is the height of the screen (this part I already manged to do)
- The root window will have a menubar on top (this part I already managed to do)
- The bottom of the root window will have a status bar (could be a text widget) - this part I didn't try to create yet
- Most of the area of the root window will be divided into two parts (This is the part that I tried to work on for a long time but had many problems). The two parts will be to Frames, one on the left and one one the right. The one on the left will be wider than the one on the right - I would like it to be something like 0.6 of the screen width and the right frame to be 0.4 of the screen width, but that something that I would like to be able to easily change I would like to. Inside each of this frames I would like to put a Text widget that will take all of the frame area. In addition, I would like to add a scrollbar widget to the right of both of the Text widgets. In addition I would like to add line numbers to the left of the left Text widgets (I saw someone that that showed how to do it in a stack exchange post, I can send the link if it's needed, it may requaire another Frame).
So, if you have some suggetstions on how to go about it, it could help.
well, i didn't do any tkinter in a literal decade, if it was with kivy i could certainly help, but maybe someone else will.
Thank you anyway. I will wait and see if someone else could help.
Hello every one, just a couple of questions.
What are the frameworks out there for creating UI on python and do you recommend some of them?
pyqt/kivy/tkinter/wxpython/pygi (for gtk) and quite a few others
i'm biased towards kivy, as i find it more fun to use and allowing for more freedom, and portability to android/ios is a pretty strong point imho, but it's certainly less integrated on desktop, and does suffer from some limitations, so there are cases where that's not what you want to use.
and also, i'm a contributor to it
i would say pyqt is certainly the best alternative, when kivy is not what you want, pyqt certainly is
(pyqt or pyside, they are almost the same thing)
Thanks for the response🤘
yw
android things
kivy
well, not much choice if you want to do android things, i mean, toga/beeware is a thing, but as far as i know it's really far from production ready, so kivy is pretty much your only option.
but i hope you'll enjoy it as much as i do 🙂
I'm working on a small program that will have sliders that interact with an images pixels in real time. Right now, I'm using pillow to alter the pixels as needed however, I'm kind of lost on how I would pair pillow with a UI library to display the changing pixels in real time. I've tried tkinter and it's extremely laggy when updating the image (my code wasn't that great either tbh). Would anyone have any suggestions on how to proceed?
Tkinter is pretty basic afaic. If your program is simple and doesn't need to look flash I guess it does the job but if the GUI is substantive I'd look into other options
If you're building for Linux maybe look into GTK or Qt?
# Python 3.8.0
# tkinter
text.get("insert linestart", "insert lineend")
returns an empty string even though there is text in the current line of typing...
Is there anyone here that knows tkinter and can help me with my question?
!ask
Asking good questions will yield a much higher chance of a quick response:
• Don't ask to ask your question, just go ahead and tell us your problem.
• Don't ask if anyone is knowledgeable in some area, filtering serves no purpose.
• Try to solve the problem on your own first, we're not going to write code for you.
• Show us the code you've tried and any errors or unexpected results it's giving.
• Be patient while we're helping you.
You can find a much more detailed explanation on our website.
Thanks. I'm using tkinter. I tried to do it in many ways, but the there are always so many problems. I'm creating a simple text editor for a language I created. The basic things that I want to include in the root windows are:
@dim basin
- The width of the root window is the width of the screen and the height of the root window is the height of the screen (this part I already manged to do)
- The root window will have a menubar on top (this part I already managed to do)
- The bottom of the root window will have a status bar (could be a text widget) - this part I didn't try to create yet
Michael NovakYesterday at 2:56 PM - Most of the area of the root window will be divided into two parts (This is the part that I tried to work on for a long time but had many problems). The two parts will be to Frames, one on the left and one one the right. The one on the left will be wider than the one on the right - I would like it to be something like 0.6 of the screen width and the right frame to be 0.4 of the screen width, but that something that I would like to be able to easily change I would like to. Inside each of this frames I would like to put a Text widget that will take all of the frame area. In addition, I would like to add a scrollbar widget to the right of both of the Text widgets. In addition I would like to add line numbers to the left of the left Text widgets (I saw someone that that showed how to do it in a stack exchange post, I can send the link if it's needed, it may requaire another Frame).
So, if you have some suggetstions on how to go about it, it could help.
How to return func value from a QThread?
Let's say I subclass QThread class like this ```python
class AThread(QtCore.QThread):
def __init__(self, func, *args, **kwargs):
QtCore.QThread.__init__(self, *args, **kwargs)
self.func = func
self.args = args
self.kwargs = kwargs
def run(self):
return self.func(*self.args, **self.kwargs)
That won't work and it'll say TypeError: invalid result from AThread.run()
What are you trying to do?
run should not return anything, use signals for communicating your results
@rocky dragon I wanna run func() in a QThread by calling AThread, and then get the return value
suppose the func is like this
def func():
return_value = 'return'
return return_value```
What are some basic user interfaces, I just want an all white text box
Oh my god, I've come up with an idea, which is running the Start class (the one that starts multi threading) in another thread to avoid blocking the mainloop while waiting for return results from threads, and this is what I got
This is so fucking dumb
Ok thank you
Could someone help me with why my method run_sim() doesn't use the new parameters from save_sim() in my program? https://pastebin.com/srMec8qe
For example, if I enter the values of 10, 5, 5, 5, it will still use the defaults of 10, 0, 0, 0
I've returned these values from run_sim(), so I'm unsure why it doesn't work
you use slots/signals to get return values out of QThreads
set up a variable, set its value to a result inside run, then attach a slot to the qthread's finished signal
finished will be emitted automatically once run is completed
you could also set up your own signal on the qthread and send the result out through the signal itself
@proper glade
Give an example
I tried subclassing QThread as I said ```python
class AThread(QtCore.QThread):
def __init__(self, func, *args, **kwargs):
QtCore.QThread.__init__(self, *args, **kwargs)
self.func = func
self.args = args
self.kwargs = kwargs
def run(self):
return self.func(*self.args, **self.kwargs))
That won't work TypeError: invalid result from AThread.run()
I tried connecting the finished signal python t = AThread(self.myfunc, self.myarg); t.start() t.finished.connect(lambda: return t) # That didn't work, How do I return here
Dealing with a mainloop is so stupid
Is there perhaps a simpler workaround, or would it be much better to do it this way?
Like, I was considering just saving the values to a list
And then perhaps the values can be loaded from the list
you transfer the result through a signal
from time import sleep as do_stuff
from PyQt5 import QtCore
class Thread(QtCore.QThread):
result_signal = QtCore.pyqtSignal(str)
def run(self):
do_stuff(0.1)
...
self.result_signal.emit("payload")
app.quit()
app = QtCore.QCoreApplication([])
a = Thread()
a.result_signal.connect(print)
a.start()
app.exec()
or if going through finished, you save it to an instance variable and connect finished to something that handles it with loading the value from that variable
no linking to returns
They're fundamental for working with qt
it calls the linked callable with what you emit
because they work within the c++ event loop you must have an app running and a signature with what you emit on creation
yes
So this will work then right return self.result_signal.emit("payload")
no return
just emit and connect that signal to a callable that handles it
run shouldn't return or only return None to stop execution
So I just assign that emit method to a variable?
Am I assigning anything up there to emit?
you connect it to something that handles what you emit
yes, a callable. So a func, method or a class with call
Ohh nvm
you can call the func you wanted to return, and then emit its result to whatever you wanted to do with what you returned
with regards to finished, you have to set up a separate variable somewhere else, set it to something inside run and then use that variable to access the result once finished is emitted
so e.g.
class WorkThread(QThread):
def __init__(self):
super.__init__()
self.result = None
def run(self):
self.result = some_stuff
Then later on:
thread = WorkThread()
thread.finished.connect(lambda: print('Result of work:', thread.result))
@proper glade Yeah dude I think I've tried that
if self.result = a_function and if I wait for thread.result() later on
It'll block the mainloop while waiting
that's not what you showed in your snippet.
I know I'm sorry I tried a lot of stuff that's why I'm asking here
So if I run it like this ```python
class AThread(QtCore.QThread):
def __init__(self, func, *args, **kwargs):
QtCore.QThread.__init__(self, *args, **kwargs)
self.func = func
self.args = args
self.kwargs = kwargs
def run(self):
self.que = que
self.result = self.func(*self.args, **self.kwargs))
And then call it ```python
thread = AThread()
result = thread.result # I think this'll block the mainloop
But self.result will run that function
look at my snippets again, you have to use thread.result inside a callback connected to the finished signal
But self.result will run that function
simply accessing self.result isnt going to run anything
Oh okay
How do I get it after that
thread.finished.connect(lambda: print('Result of work:', thread.result))
it's right there in thread.result
you can do whatever you want with it there
inside that callable
How do I get it out of the callable
Cause if I add python result = thread.result print(result) after that it'll probably print None or something like that
something like this, since you can't do assignments inside lambdas
some_value = None
def callback(value):
some_value = value
thread.finished.connect(lambda: callback(thread.result))
not much point to this though
Alright that makes sense I guess
you might need a global some_value or nonlocal some_value at the top of the callback function
to fix scoping issues
Yeah got it thank you
Hi, how can I implement a cellDoubleClicked signal (like the one in QTableWidget), when using a QAbstractTableModel inside a QTableView?
@gaunt portal QTableView, by virtue of being a child of QAbstractItemView, has a doubleClicked signal
Ok, I'm not sure how to send the signal, I'll show some code
the signal gets sent automatically
when you double click an item
it's built in
you just gotta connect stuff to it
def __init__(self, con, cur, students_ui, student_dialog, add_borrow_dialog):
super(Students, self).__init__()
self.table = QTableView()
self.verticalLayout.addWidget(self.table)
self.insert_data(data)
def insert_data(self, data):
self.model = TableModel(data)
self.table.setModel(self.model)```
This is the widget that holds the table view
def __init__(self, data):
super(TableModel, self).__init__()
self._data = data
def data(self, index, role):
if role == Qt.DisplayRole:
return self._data[index.row()][index.column()]
def rowCount(self, index):
return len(self._data)
def columnCount(self, index):
if self._data == []:
return 0
return len(self._data[0])```
The table model
You mean I should send the signal inside the TableModel class, but I want to connect it to a function in the Student class
what i mean is you don't have to implement or emit it yourself
but the callable lives in the Student class, and the signal is sent inside the TableModel class
e.g.
self.table.doubleClicked.connect(lambda index: print(index))
yes, but the scope wil not let me do this
the signal is emitted by the treeview, not the model
tableview*
it belongs to the tableview
class Students(QWidget):
def __init__(self, con, cur, students_ui, student_dialog, add_borrow_dialog):
super(Students, self).__init__()
self.table = QTableView()
self.verticalLayout.addWidget(self.table)
self.insert_data(data)
def insert_data(self, data):
self.model = TableModel(data)
self.table.setModel(self.model)
def open_dialog(self, row, column):
student_id = self.table.item(row, 0)
dlg = StudentDialog(self.con, self.cur, student_id.text(), self.student_dialog, self.add_borrow_dialog)
dlg.exec_()```
So I want to call the open_dialog func
And inside the TableModel
def __init__(self, data):
super(TableModel, self).__init__()
self._data = data
self.table.cellDoubleClicked.connect(self.open_dialog)
def data(self, index, role):
if role == Qt.DisplayRole:
return self._data[index.row()][index.column()]
def rowCount(self, index):
return len(self._data)
def columnCount(self, index):
if self._data == []:
return 0
return len(self._data[0])```
I would need to do something like this
but the open_dialog func does not belong to the tablemodel
why do you need to connect it inside the model
you already have the tableview there in the Students class
open_dialog belongs to the Students class
Oooh, I got the inheritance wrong
Ok, let me try
Yep, works, I get the index of the cell that I click on
I can't find how to get the data from a given cell, when I know the coordinates, I'm searching the docs for 10 mins
Ok, and I want to get the data of the first column, no matter where I click on the row, do I need to create another qmodelindex?
qtablemodel probably has a method for getting the qmodelindex for a given coord
so yea same row, column 1
imo you should just store the data list in Students
so you can access it directly in the callback
https://doc.qt.io/qt-5/qtableview.html#indexAt there it is
damn, right
and then I just call .data() for that index
Uh, stuck again
student_id = self.table.indexAt(QPoint(index.row(), 0))
print(student_id.row())
dlg = StudentDialog(self.con, self.cur, student_id.row(), self.student_dialog, self.add_borrow_dialog)
dlg.exec_()```
student_id.row() always returns 0
But index.row() will return the row that I clicked on
I'm not sure what's wrong
oh right indexAt is asking for literal content coordinates
not grid cell coordinates
https://doc.qt.io/qt-5/qmodelindex.html#siblingAtColumn this might be more useful
@gaunt portal
can you change a bool with root.after in tkinter?
@proper glade , I managed to solve this, by calling self.model.index(cell_index.row(), 0).data for the QTableModel, where cell_index is the cell that I click on
This returned the corect data that I needed
Thanks for the help
I need suggestion should I use python for gui or something else like electron
I need best ui/ux like we have in js and css but should be fast not like vs code
@gaunt portal if you use https://doc.qt.io/qt-5/qmodelindex.html#siblingAtColumn you can get the model index at column 1 without needing to access the model
I tried that, but it always returned an Invalid Index (-1,-1)
Maybe I implemented it wrong, idk
But I'm happy that it works with model.index()
@digital rose If you're familiar with javascript, try electron (discord is built using electron)
Otherwise, there are python libraries like pyqt5, kivy or tkinter, each with advantages and disadvantages, just google about them and see what suits you
hi all, i am trying to build an interface similar to this one, where the user can drag-to-create line segments connecting points on a fixed grid, select the line segments afterwards and "color" them, etc...is this something that could be easily achievable in pyqt5? or should i look at a different library?
Would anyone here happen to be very familiar with the inner machinations of qt
Why does cursor.insertBlock add a new li to my list, but calling cursor.createList (or cursor.insertList) creates the new ol outside the current list
@steel pendant If you know c/c++, you can achieve that by using the SFML library, pyqt is kinda for making GUIs, rather than animated apps
Or you could use pygame
interesting, yea i do know a bit of c++. was also considering doing this with svgs and javascript
thanks for the idea @gaunt portal
this can be fairly easily done with a qgraphicsscene/view @steel pendant
there's even a built in selection mechanism for qgraphicsitem objects
can anyone help me with pyqtgraph?
im using Qt Creator to make a form.ui then use pyuic5 to make a form.py which i can then use in my program, ive tried following the pyqtgraph guides, my issue is i seem to have 2 graphs, the one im updating and using is really small and the one im not using is the right size, any ideas to only have one graph and fix the size?
so far in my def __init__(self): ```py
self.graphWidget = pg.PlotWidget(self.form.temperatureGraph)
#self.setCentralWidget(self.graphWidget)
self.x = list(range(24)) # 24 time points
self.y = [randint(0, 100) for _ in range(24)] # 24 data points
self.graphWidget.setBackground('w')
pen = pg.mkPen(color=(255, 0, 0))
self.data_line = self.graphWidget.plot(self.x, self.y, pen=pen)
self.timer = QtCore.QTimer()
self.timer.setInterval(2000) # Update every 2 seconds
self.timer.timeout.connect(self.update_plot_data)
self.timer.start()```and then ```py
def update_plot_data(self):
self.x = self.x[1:] # Remove the first y element.
self.x.append(self.x[-1] + 1) # Add a new value 1 higher than the last.
self.y = self.y[1:] # Remove the first
self.y.append(randint(0, 100)) # Add a new random value.
self.data_line.setData(self.x, self.y) # Update the data.```
could you answer my question - https://stackoverflow.com/questions/60758937/python-tkinter-layout-creating-two-text-widgets-with-scrollbar-in-a-full-scree ?
How to add grey text like this in QLineEdit
setPlaceholderText
the pyside docs are quite useless on this one but here
https://doc.qt.io/qt-5/qlineedit.html#placeholderText-prop
Thank youu
How to get cells count from a QGridLayout
is there any library to make more customizable/cool GUI like discord's or any other application
i usually use tkinter
but is there any other library that creates more modern GUIs?
did you look at Kivy?
in matter of customizable, i think it's pretty much the best 🙂
hm, it does help if you are decently familiar with python and classes in it.
you can start simple, but as it gives you a lot of flexibility, it does help to really understand the basic ideas, or it feels like dark magic and hard to reason about
ty man
Anyone experienced with PyQt5 and Matplotlib? I am working on incorporating some graphs into my program and I am having trouble in a few way
- I have two graphs inserted as Figures onto a canvas. I have had trouble resolving the desire to refresh the graphs on command via a Pysignal/Pyslot method. Any ideas?
- I am working on inserting a Line graph into a Frame. However, I am using
pltinstead offig, ax. Do I need to rewrite my code asfig, axor is there a different method for inserting apltplot? I have had issues shifting the plot from one method to the other while maintaining all the features i want. Such as fill between.
also, i do have code to share but was waiting for a response before dumping code
@digital rose Discord is made using Electron, which uses javascript, html and css
@sullen thunder This website has a tutorial for pyqt5 and matplotlib https://www.learnpyqt.com/courses/graphics-plotting/plotting-matplotlib/, if you followed this, maybe someone else can help you
@gaunt portal I will take a read over that. I don't think I have come across that tutorial yet.
The site is rather useful, it really takes you over the basics and going through some advanced stuff, like mvc and packaging your script
Also, for anyone wanting to package their PyQT5 App into a standalone .exe/installer, I highly recomend fbs https://build-system.fman.io/
fbs lets you release Python GUIs with Qt in minutes instead of months.
ty @gaunt portal
Can a widget have a multiple layouts
@wide stump which framework? and precise what you mean by "multiple layouts", can you give an example of what it would allow you to achieve?
PyQt
Basically I've set up a grid layout already of my program
And added all widgets there
But when an error happens I wanna show an error label
and I can't add that to the mainllayout cause it'll get auto sorted
I want the error frame to always appear in the center
And I can't use screenGeomtry to get the screen center and use it because if the user moves the window it'll look weird and stupid
I think i'll just put it in the center of the central widget
How can I get the object name of the connected QWidget
self.optionCheckbox.clicked.connect(self.uncheck)
And use it in self.uncheck
@wide stump How I see it, you could either put an empty QLabel widget, and when the error happens, set the text of that QLabel to whatever you want to show
Either open an error dialog, which seems more common, but it depends on what you want the workflow to feel like
Dialogs pretty much interrupt the flow
Lol I did it without QGroupButton
self.optionCheckbox.clicked.connect(partial(self.uncheck, self.optionCheckbox.objectName()))
def uncheck(self, objname):
checked = []
for i in range(self.VLayout.count()):
if self.VLayout.itemAt(i).widget().isChecked():
checked.append(self.VLayout.itemAt(i).widget())
for e in checked:
if e.objectName() != objname:
e.setChecked(False)```
In PyQt5, I want to make sure that a QLineEdit always returns a numerical value (aka the user can't type characters in the box)
How can I do that
I'd just use a spinbox
real quick: python 3.8.0 tkinter
if i know an image size and window size, can i know if it overlaps with its right border using windowsize+imagesize<windowsize?
you can apply a regex to it but not needed here when we have spinboxes
Oh cool, that's literally what I needed
Thanks
@mighty rock Why don't you just test that? (I'm not familiar with tkinter, but just make some tests and see if it gives you the result you want)
ok
If it doesn't, ask here
How to set minimum size of all widgets in a QVBoxLayout
you can set min size of rows and columns
@rocky dragon Sorry I meant QVBoxLayout, and how can I do that?
Can I ask my help for kivy here?
Yes
Thank you
from kivy.animation import Animation, Sequence, Parallel
from kivy.app import App
from kivy.clock import Clock
from kivy.properties import ListProperty
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
global l1
class MySequence(Sequence):
widgets = ListProperty([])
class MySequence(Sequence):
widgets = ListProperty([])
def start(self, widget):
super(MySequence, self).start(widget)
self.widgets.append(widget)
def stop(self, widget):
if widget in self.widgets:
self.widgets.remove(widget)
super(MySequence, self).stop(widget)
def __add__(self, animation):
return MySequence(self, animation)
def __and__(self, animation):
return MyParallel(self, animation)
class MyParallel(Parallel):
widgets = ListProperty([])
def start(self, widget):
super(MyParallel, self).start(widget)
self.widgets.append(widget)
def stop(self, widget):
if widget in self.widgets:
self.widgets.remove(widget)
super(MyParallel, self).stop(widget)
def __add__(self, animation):
return MySequence(self, animation)
def __and__(self, animation):
return MyParallel(self, animation)
class MyAnim(Animation):
widgets = ListProperty([])
def start(self, widget):
super(MyAnim, self).start(widget)
self.widgets.append(widget)
def stop(self, widget):
if widget in self.widgets:
self.widgets.remove(widget)
super(MyAnim, self).stop(widget)
def __add__(self, animation):
return MySequence(self, animation)
def __and__(self, animation):
return MyParallel(self, animation)
class TestApp(App):
def __init__(self, **kwargs):
super(TestApp, self).__init__(**kwargs)
self.label = Label(text='label', size_hint=(None, None), size=(100, 500), pos=(400, 200))
self.animation = MyAnim(pos=(200, 200), d=5)
def animate(self, instance):
self.animation.on_complete = self.completed
# sequential
# self.animation += MyAnim(pos=(400, 400), t='out_sine')
# parallel
self.animation &= MyAnim(size=(200, 300), d=5)
Clock.schedule_once(self.another_anim, 1)
self.animation.start(instance)
def another_anim(self, dt):
global l1
self.animation.start(self.label)
l1 = self.animation.widgets
def completed(self, widget):
print('Animation completed - animated Widget:', widget)
Clock.schedule_once(self.check_anim, 2)
def check_anim(self, dt):
global l1
print(l1)
print(dt, 'seconds after Animation completed - animated Widgets:', l1)
def build(self):
fl = FloatLayout()
button = Button(size_hint=(None, None), size=(100,50), pos=(0,0), text='click here', on_press=self.animate)
fl.add_widget(button)
fl.add_widget(self.label)
return fl
if __name__ == '__main__':
TestApp().run()
I have a list called l1 which contains self.animation.widgets when I print the value of l1 it prints [] but I need the objects which are animated in l1!
Don't use a global, you can easily put l1 as a listproperty of your app to access it easily
What library do I have to import to use a QStringList in PyQt5?
The docs says it lives in QtCore, but when I try to import it from there :```Traceback (most recent call last):
File "d:/Proiecte/Python/OLDI/src/main/python/mainmenu.py", line 3, in <module>
from PyQt5.QtCore import Qt, QDate, QPoint, QModelIndex, QStringList
ImportError: cannot import name 'QStringList'
Why do you want it?
To set the lables of a QTableView
you don't have QStrings, QStringLists or whatever in the python api. They get converted to python types or converted from them
Exactly, I want to convert from a python list to a QStringList
passing a list of strings should work
Oh, ok
QStringList doesn't exist in pyqt
Yeah, apparently I was looking on the docs of qt4
Ok I have a list of column names that I want to use to change the column lables in a QTableView
What can I use?
hey, im drawing many (200+) 2D designs. its like a tessellation if youre familiar. they look like grids but each cell updates based on its neighbor
ive used tkinter before, but using it in an object oriented way makes it reallyyyyyy slow. and each cell's state must be saved for the program to update
woah, that's cool
any suggestions on libraries/graphics engines?
both PyQt5 and kivy are object-oriented
gotcha
and thanks! you can read more at https://www.wolframscience.com/nks/p51--the-search-for-general-features/
the backend is sups simple: you start with an array like [0,0,1...] to represent every cell as dead or alive. then you have a rule, like if a 0 is surrounded by other 0's it stays 0. you make more rules and then you update the array. i just am not sure of how to draw it in python
Hey JustAndy,
thank you for the previous link about redrawing line graphs. Do you know how to apply it to a pie graph? most of what they have in the tutorial seems to apply. But it doesn't seem to clear the graph.
@round hazel It's being saved in the selection attribute of the popup widget. Your main class has a reference to an instance of that widget in self.exPopup.
So self.exPopup.selection would get you that value.
@sudden coral Thanks...but hmm, I'm getting AttributeError: 'searchPopup' object has no attribute 'exPopup' when I try to do something simple like
y = self.exPopup.selection
print(y)
That's supposed to be done in the main class, not the popup widget
It boils down to this ```py
class Main:
def init(self):
self.popup_instance = Popup()
print(self.popup_instance.selected)
class Popup:
def init(self):
self.selected = "hello, world!"
You need to access an attribute via an instance of the class
It is in the main class. Here's the updated code: https://github.com/LiquidHamilton/Testing/blob/master/bgglookup.py
Line 113 is where it's called.
Line 169 is the method in the class where it's created.
The error says that searchPopup doesn't have the attribute, which means self is a searchPopup. If it was in the main class it would say Ui_MainWindow 🤔
Oh, you're calling lookup from within the popup class
That's why self is the popup
Why are you doing that?
Do you want that behaviour i.e. for lookup to be called after clicked?
Basically, it runs lookup based on a search inquiry. If it finds the result on its own, it runs "lookup" with the ID it found. Otherwise, it creates the popup with search results. If you select a result, it will get an ID that it should pass back into the main class and re-run "lookup" with the selected ID
I feel like using a QDialog would be better suited for this.
Or at least using signals and slots in some way so that your main class knows when the a selection was made
The main class should be responsible for calling the lookup, not the popup window.
So the popup can signal to the main class something was selected and that's it. The popup shouldn't need to know or care what the main window does with that info, as it's not the popup's job to be concerned with that. It's job is to display a list for a user to select a value.
I originally was trying to use a qdialog but I didn't think it could have a list widget built into it so I abandoned that idea. It would be easier than a second class.
And I also thought about signals and slots but that's a bit more than I know how to do with PyQt at the moment. I've played around with them but haven't really grasped the whole concept even though it seems simple enough. You're right that either of those two options would be best. If I can figure out signal/slot I think that would work.
QDialog is convenient because it has some signals already built in and your main class could just connect to them
QDialog can have any widgets, including a list.
If you have more questions about it I can try to answer
Ok well I appreciate the info you've given. I'll give QDialog a shot and see what I can do with that so I can abandon the second class.
Well it still should be a separate class
The dialogue window would be a separate window from the main window.
Oh hmm. I guess I need to go back to the documentation then and try to figure this out. Didn't realize it would be such a daunting task to pass a single int, haha. I've given up on this project multiple times over the past few months because of this very reason.
Indeed I find the topic of inter-widget communication is a struggle for many beginners of the library.
There's probably a lot of bad ways to do it which are simpler 😄
At this point, all I need is some simple hack job to make it work. This is really just a personal passion project to learn more about PyQt, and this is my last step to making it functional. What would YOU do in this instance to get that to work?
Me, given my experience, would make a QDialog. In your position, give me a moment to think about it.
But it's worth mentioning that if your goal is to learn PyQt then wouldn't you want to learn how to do things the right way?
QDialog is an opportunity for you to learn something new, if that is what you're after
You're right, and I do like learning new techniques. I've just been working on it so long and the end is so close. But, you're right, I'll learn QDialog and try to make it work correctly.
Looking at examples really helped me learn this library. Maybe that a good learning method for you too.
That's how I've been doing it. I've been deconstructing examples to learn how they work. That's how I learn best...taking a completed example and breaking it down.
I used QDialogs in this project of mine
It's not super well documented or high quality code cause it was a code jam and I had like a week
A thing to note is that I re-use dialogs rather than re-creating them, so my dialog classes sometimes have extra code to reset their state. You don't have to do it this way. Creating a new dialog is fine too.
Hmm, I appreciate the help. I'll see what I can learn from that. One last quick question though. If I create the QDialog from the main class, as a separate method, what is the second class for then? All the other examples I've seen create the dialog within the main class.
You subclass QDialog to customise its UI and behaviour.
Ah gotcha.
Wait but then wouldn't I be back to square one of having to send the result from that class back to the main class?
Or does QDialog have a built in signal for that?
Yes and yes
Ok perfect. Thanks for all the help! I'll stop bugging you and go read haha
Well sort of, there's not a signal to retrieve a value per se, but there are signals for when the dialog is completed/closed, so you know the user is done choosing and its safe to retrieve the value now.
But there is also this https://doc.qt.io/qt-5/qdialog.html#return-value-modal-dialogs
Perfect!
One final question. I'm just about there! I've got a QDialog working now, and I have it sending the accept signal, which outputs "1" as it should. How do I change this to send the int value back instead of just "1"? Relevant code:
# from main class
def popup(self, results):
self.popupsearch = searchPopup(results)
self.result = self.popupsearch.exec()
print(self.result)
#from dialog class
def clicked(self, qmodelindex):
self.item = self.listwidget.currentItem()
self.row = self.listwidget.currentRow()
self.selectionindex = self.results[self.row]
self.selection = self.selectionindex.id
self.accept()
I want the accept signal to send the value of self.selection
Scratch that! I figured it out. I used self.done(self.selection)
How to get objects that are animated in kivy?
what do you mean?
there are animations, and there are widgets, and an animation can be applied to some widgets, until it's done
the animation knows which objects it's being applied to, but it's its internal state, i don't think you should rely on it, if you applied the animations to widgets, you should be able to keep track of which
@wind current
I did that my self
How to change the PyQt file's icon?
setWindowIcon on the app with a QtGui.QIcon object
I'm having a display problem with pygame my file is 100 lines of code long so I don't want to post it all here so here is a pastebin of it https://pastebin.com/9wMZjwjj
the background color (255,255,255) is drawing vertically off the screen instead of horizontally like I want it to
the code uses the screen size/play size to calculate the positioning of said background color, I could use some pointers to resources to fix this as I have no idea what to look for
Hey, I'm trying to integrate pygame and pyside2.... I found this: https://stackoverflow.com/a/38284856, which works... but how can I set the widget to a specific coordinate?
rn its just in the top left corner
self.setCentralWidget(ImageWidget(surface))```
I'm having a problem where in func game_input all if and 2 elifs are true https://hastebin.com/yeyeravucu.rb
Or at least they become so after one is true
@dense whale you can use the move() function for the ImageWidget https://doc.qt.io/qt-5/qwidget.html#move-1
something like self.move(x,y) where (x,y) is the point where you want to move the widget
@digital rose What do you mean by 2 elifs are true? Does the app also run them?
Try to set a break point before the game_input func and run the app step by step in debugging mode, to see what if statement is executed
Does anyone know where to learn basic UI design, or how to make things look better in PyQt5?
What break point?
There are 1 if and 2 elifs in the func
and all of them get run
Oh I was wrong
same if is getting run 3 times
fixed it
stupid question but how can I use javascript to code a GUI but not have it open in a webpage but rather like a window with a x minimize and expand button. I want to make the frontend for my python code but don't want to use tkinter to do it
There are other options for GUIs besides tkinter that are in Python
It sounds like you're thinking of Electron but with a Python backend. Maybe that could work but it sounds complicated to me. I'm not a JS dev so what do I know.
Seems like the two languages wouldn't interface well
oh its not just as simple as assigning functionality to javascript elements?
No, unless your Python app is like a REST API or something.
JustAndy (didn't' want to ping you, but hope you see this)
Thank you again for the direction to the tutorial. I was able to utilize it to build my desired application. My nested pie graphs due now update upon receiving the proper signal.
I don't think i fully understand why the tutorial creates its own canvas class. I think, what it is doing is turning the Matplotlib canvas into a PyQt5 widget that can be interacted with via the FigureCanvasQTAgg object.
You're welcome @sullen thunder
From what I have seen, matplotlib also uses this approach https://matplotlib.org/gallery/user_interfaces/embedding_in_qt5_sgskip.html
From learnpyqt :
Plots from Matplotlib displayed in PyQt5 are actually rendered as simple (bitmap) images by the Agg backend. The FigureCanvasQTAgg class wraps this backend and displays the resulting image on a Qt widget. The effect of this architecture is that Qt is unaware of the positions of lines and other plot elements — only the x, y coordinates of any clicks and mouse movements over the widget.
So Qt(pyqt5) interprets the FigureCanvasQTAgg as a image
Which you can apply simple qt func on, OR use the functions provided by Matplotlib
It's not great
is kivy developer 😄
Tkinter is useful, but the documentation can be hard to find
<input ng-keyup="$event.keyCode === $ctrl.keyCodes.enter && $ctrl.getMember($ctrl.keyword)" ng-model="$ctrl.keyword" class="form-control input-field ng-valid ng-valid-maxlength ng-dirty ng-valid-parse ng-touched ng-empty" type="text" placeholder="Search Members" maxlength="120">
how do i get the element of this?
(its a searchbar)
stupid question but how can I use javascript to code a GUI but not have it open in a webpage but rather like a window with a x minimize and expand button. I want to make the frontend for my python code but don't want to use tkinter to do it
@willow prism you can use pyqt5/pyside2 webengine and communicate front and back ends using webchannels. I’ve done a project using that architecture
Can I use modules inside a function?
Because I used one inside a function and it's not working instead it's giving me an exception.
!e ```py
def num():
import random
return random.randint(0,10)
num()
Sorry, but you may only use this command within #bot-commands.
@digital rose https://discordapp.com/channels/267624335836053506/267659945086812160/692640519477526528 see example
tldr; yes u can
I mean if that module wasn't mentioned inside a function but outside of it.
Will it still work?
ofc
Hey i wanna make this
https://upload.wikimedia.org/wikipedia/commons/1/1a/Fourier_series_square_wave_circles_animation.gif
WHat would be a good canvas? I tried using p5 its very buggy
I did it with Pygame :P
Could you use module 'requests' in a GUI?
Because 'requests' gets a specific information from the chosen API.
And I think GUI can't interact with Internet connection, can they?
GUIs can interact with the internet
Yes, requests module can be used in a GUI.
Though you may want it in a separate thread so long requests don't seize your application.
I think the best python canvas is probably QGraphicsView in pyqt5
i must say kivy has a very powerful canvas too, it's basically opengl, but in easy mode
opengl and easy are two words that often shouldn't live together lol
@bitter merlin can it make live animations like those ^?
There are lines and circles in my py game
and i want all the lines to be above the circles
like no pixel of circle should be seen over a line
how will i be doing this?
in simple terms
i want no circle to overlap a line
like if lines and circles overlap i want line to be seen
ping me if you answer
@latent mortar what library
PyGame @elfin stirrup
ok
@latent mortar not the proper parameters, and code is a bit quick and dirty, but just to give you an idea https://gist.github.com/8b9f989101f20045f04aafe583403401
just keep the lines and circles in different groups
with the graph program i'm working on, i keep node and edge instructions separate like this:
self._edge_instructions = CanvasBase()
with self._edge_instructions:
self.edges = {edge: Edge(edge, self) for edge in self.G.edges()}
self.canvas.add(self._edge_instructions)
self._node_instructions = CanvasBase()
with self._node_instructions:
self._source_color = Color(*SOURCE_COLOR)
self._source_circle = Line(width=SOURCE_WIDTH)
self.nodes = {vertex: Node(vertex, self) for vertex in self.G.vertices()}
self.canvas.add(self._node_instructions)