Master PyQt5 part 5: Moving data between windows

  Рет қаралды 20,388

Alan D Moore Codes

Alan D Moore Codes

4 жыл бұрын

Author Alan D Moore answers a viewer question about moving data between objects. Also includes a followup on Signals and Slots.
Follow Alan at www.alandmoore.com
Purchase a copy of Mastering GUI Programming with Python here: amzn.to/3Dr8cAy
Example code for this video can be found here: github.com/alandmoore/PyQt-Vi...
Previous video in this series: • Master PyQt5 part 4: I...
Thanks for watching!

Пікірлер: 38
@TillSeyfarth
@TillSeyfarth Жыл бұрын
"So there's a few ways we can do that". Love that approach! This series is such a gem.
@kevinclary5167
@kevinclary5167 4 жыл бұрын
This was the exact tutorial I needed - thank you!
@alandmoorecodes3585
@alandmoorecodes3585 4 жыл бұрын
Awesome!
@michaelbowen8864
@michaelbowen8864 3 жыл бұрын
This was immensely helpful, thank you so much
3 жыл бұрын
Thank you so much!!! I am very grateful not only for your videos but your books have helped me a lot in this long path of programming in Python and PyQt.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Thanks!
@Linuxovert
@Linuxovert 4 жыл бұрын
thanks Alan I will try to reuse this code in finishing my "Request Form for events" that i'm working on for the last couple of months.
@OficinadoArdito
@OficinadoArdito Жыл бұрын
man... not all heroes wear capes... thanks a LOT!
@hanzofuma
@hanzofuma 4 жыл бұрын
omg, thx so much you are a saver I struggled on how to move the data with QtCore.Signal or with Getters or with the constructor 2 hours and i m changing the code until i found your video
@alandmoorecodes3585
@alandmoorecodes3585 4 жыл бұрын
Awesome, glad it helped!
@chrisw5509
@chrisw5509 2 жыл бұрын
Fantastic video!! I used what you presented to create a button that pops up the Calendar Widget. My next steps which are to set the input field (widget) to sync with the calendar. Based on what you have provided in the video I should be able to accomplish that. I'm working my way through your videos. If you publish a book on PyQt6. I plan to buy it. I know you have a book on PyQt5 but want to wait for PyQt6 version.
@alandmoorecodes3585
@alandmoorecodes3585 2 жыл бұрын
Thanks! I looked at doing a PyQt6 version of the book earlier this year, but PyQt6 was still incomplete and the timing was just wrong. Been busy with another book project in the meantime, so it won't be forthcoming anytime too soon.
@barretoingridy
@barretoingridy 2 жыл бұрын
You're awesome!!!! Thank you =D
@quleman
@quleman 4 жыл бұрын
Thank you
@alu9645
@alu9645 3 жыл бұрын
I would love to see your emacs tutorial and setting for python. That would be really great!
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Thanks! My emacs config is a bit of a mess at the moment, but maybe I can clean it up a bit and share.
@cinquecento1985
@cinquecento1985 Жыл бұрын
thank you. little confusing, but I got it working.
@Factory400
@Factory400 3 жыл бұрын
Ordering the book now......I need to be swept off my feet :-)
@DanArizona
@DanArizona 3 жыл бұрын
Hi Alan, great stuff. You put your signal/slot methods code into your dialog class. If Dialog was created using designer, would you recommend another file to contain the signal/slot methods? So two files for the two window GUIs (Main and Dialog), and two files to manage those GUIs.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Yes, remember that what comes out of designer is *not* your actual dialog widget, but an object which will build the GUI you designed on a widget class that you provide. See my video on "QtDesigner and PyQt5" for more detail on that. You'll need to create your own QWidget or QMainWindow subclass on which this builder class will build the UI, and in which you can define callbacks, signals, etc.
@catseye2500
@catseye2500 2 жыл бұрын
Mr. Moore, I am new to python programming and PYQt5. I watched your video and it was very good. I am having an issue though, where when I get user name from one class, when it is suppose to pass the name to the other class it displays nt instead of the name. I am at a loss on how to fix the issue.
@tungbrian4108
@tungbrian4108 2 жыл бұрын
What if passing value from sub module to main module
@someoneontheinternetuvenev6268
@someoneontheinternetuvenev6268 3 жыл бұрын
It would be great if you made a tutorial about QStackedWidget, sadly there really isn't any good tutorials for this and the ones that exist only show how to create multiple screens but don't show how to properly pass data between screens. (their method is basically just adding more and more widgets to the stack and none of them mention how to prevent the crazy memory leak that happens when you do that)
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
I'll see what I can do.
@adamkrysztopa6778
@adamkrysztopa6778 3 жыл бұрын
I like the way you explained that. I have a question: I was always creating 'sub window' as a child class of Main. After that I was referring to the Main window as e.g. in that case: self.parent().set_messages(...). I wondering if it is anyway non-optimal or non-elegant.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
I think you can get away with stuff like this to a degree if you're consistent, but it does leave your classes tightly coupled. Your class has to assume that "parent" will always be an object with set_message(), for example. If for some reason that arrangement needs to change (for example, a form needs to become a child of a different widget, or become its own window), you're stuck. One aspect of elegant code is code that it solves the same problem in a consistent way. If you're communicating between child windows and the main window using direct calls, you can't use the same method to communicate between two windows or two sibling widgets. By sticking with signals and slots, you can communicate consistently between any objects in your app. To me that seems more elegant than mixing methods.
@rimshayawar2290
@rimshayawar2290 2 жыл бұрын
If there are three classes A, B, and C, and if I want to pass data from A to C using the PushButton of B window to open the C window. How I can accomplish this task?
@GerardoBelot
@GerardoBelot 3 жыл бұрын
8:55 pass a signal from other win to main, just to remind me!!
@mohamedyahya4014
@mohamedyahya4014 4 жыл бұрын
greate tutorial big thanks....... I got a question which is I have tow classes, emitting a signal from A to B when trying to print the signal object it gives me " " could you help me with why is that happening and how to read the object as a valid python data type so I can use it the required point, please?
@alandmoorecodes3585
@alandmoorecodes3585 4 жыл бұрын
That's what I would expect a signal object to show if I printed it. Not sure what you were expecting.
@wandersonfelipe5588
@wandersonfelipe5588 2 жыл бұрын
Hey Alan, thanks so much for the content. I got to do what you did, and it works, but with a little error: I've got to send the information from the dialog window to the previous one, but when closing the dialog, I receive the message "TypeError: native Qt signal is not callable", then the program ends. What could I do to fix that?
@alandmoorecodes3585
@alandmoorecodes3585 2 жыл бұрын
Sounds like you've got some parentheses in the wrong place. Would need to see your code to be sure.
@wandersonfelipe5588
@wandersonfelipe5588 2 жыл бұрын
@@alandmoorecodes3585 how can I send you the entire code?
@wandersonfelipe5588
@wandersonfelipe5588 2 жыл бұрын
@@alandmoorecodes3585 I SOLVED IT. On the dialog box (the secundary window), I was using a QtWidgets.QDialog (which was making the program end when closed), then I replaced it by a QtWidgets.QWidget, and now it is working very well.
@himanshupoddar1395
@himanshupoddar1395 2 жыл бұрын
9:33 Why using submitted signal? why not use submit button on click
@richiericher9084
@richiericher9084 3 жыл бұрын
apperently PyQt5 doesn't have a lot of users. Otherwise your tutorials would have much more views since they are just excellent.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Thanks! This channel's growing fast, though, I can't really believe it.
Master PyQt5 part 6:  QMainWindow for easy apps
27:05
Alan D Moore Codes
Рет қаралды 12 М.
QtDesigner and PyQt5:  The right and wrong way to use them together
37:16
Alan D Moore Codes
Рет қаралды 107 М.
когда повзрослела // EVA mash
00:40
EVA mash
Рет қаралды 4,3 МЛН
Alat Seru Penolong untuk Mimpi Indah Bayi!
00:31
Let's GLOW! Indonesian
Рет қаралды 16 МЛН
Use Arc Instead of Vec
15:21
Logan Smith
Рет қаралды 138 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 249 М.
How to pass data from one window to another | PyQt5 Tutorial
7:20
This definition of "god" will blow your mind
24:32
Rabbi Manis Friedman
Рет қаралды 7 М.
Tkinter vs. PyQt:  Which Python GUI framework is right for you?
38:11
Alan D Moore Codes
Рет қаралды 64 М.
Master PyQt5 part 10: Make responsive GUIs with Threads
33:35
Alan D Moore Codes
Рет қаралды 19 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 763 М.
Working with signals and slots in PySide or PyQt.
29:02
Jason Codes Qt
Рет қаралды 4,3 М.
Master PyQt5 part 11:  Application Infrastructure and Communication
33:51
Alan D Moore Codes
Рет қаралды 4,5 М.
Спутниковый телефон #обзор #товары
0:35
Product show
Рет қаралды 2,2 МЛН
После ввода кода - протирайте панель
0:18
Up Your Brains
Рет қаралды 1,2 МЛН
Опыт использования Мини ПК от TECNO
1:00
Андронет
Рет қаралды 766 М.
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 6 МЛН
Собери ПК и Получи 10,000₽
1:00
build monsters
Рет қаралды 2,4 МЛН